cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/components/search SimpleLuceneXMLIndexerImpl.java
Date Sun, 28 Mar 2004 14:28:05 GMT
antonio     2004/03/28 06:28:04

  Modified:    src/java/org/apache/cocoon/components/crawler
                        SimpleCocoonCrawlerImpl.java
               src/java/org/apache/cocoon/generation
                        LinkStatusGenerator.java
               src/java/org/apache/cocoon/util NetUtils.java Tokenizer.java
                        IOUtils.java StringUtils.java
               src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp
                        XSPUtil.java
               src/blocks/databases/java/org/apache/cocoon/transformation
                        SQLTransformer.java
               src/java/org/apache/cocoon/acting
                        AbstractValidatorAction.java
               src/blocks/mail/java/org/apache/cocoon/acting Sendmail.java
               src/blocks/lucene/java/org/apache/cocoon/components/search
                        SimpleLuceneXMLIndexerImpl.java
  Log:
  Using new methods of Apache commons.lang.
  Deprecating o.a.c.utils.Tokenizer class and
  some methods of o.a.c.utils.StringUtils
  in favor of same methods in o.a.commons.lang.
  
  Revision  Changes    Path
  1.5       +9 -9      cocoon-2.1/src/java/org/apache/cocoon/components/crawler/SimpleCocoonCrawlerImpl.java
  
  Index: SimpleCocoonCrawlerImpl.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/components/crawler/SimpleCocoonCrawlerImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleCocoonCrawlerImpl.java	5 Mar 2004 13:02:46 -0000	1.4
  +++ SimpleCocoonCrawlerImpl.java	28 Mar 2004 14:28:04 -0000	1.5
  @@ -22,7 +22,7 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.cocoon.Constants;
  -import org.apache.cocoon.util.Tokenizer;
  +import org.apache.commons.lang.StringUtils;
   import org.apache.regexp.RE;
   import org.apache.regexp.RESyntaxException;
   
  @@ -183,9 +183,9 @@
               for (int i = 0; i < children.length; i++) {
                   String pattern = children[i].getValue();
                   try {
  -                    Tokenizer t = new Tokenizer(pattern, ", ");
  -                    while (t.hasMoreTokens()) {
  -                        String tokenized_pattern = t.nextToken();
  +                    String params[] = StringUtils.split(pattern, ", ");
  +                    for (int index = 0; index < params.length; index++) {
  +                        String tokenized_pattern = params[index];
                           this.includeCrawlingURL.add(new RE(tokenized_pattern));
                       }
                   } catch (RESyntaxException rese) {
  @@ -205,9 +205,9 @@
               for (int i = 0; i < children.length; i++) {
                   String pattern = children[i].getValue();
                   try {
  -                    Tokenizer t = new Tokenizer(pattern, ", ");
  -                    while (t.hasMoreTokens()) {
  -                        String tokenized_pattern = t.nextToken();
  +                    String params[] = StringUtils.split(pattern, ", ");
  +                    for (int index = 0; index < params.length; index++) {
  +                        String tokenized_pattern = params[index];
                           this.excludeCrawlingURL.add(new RE(tokenized_pattern));
                       }
                   } catch (RESyntaxException rese) {
  
  
  
  1.9       +8 -8      cocoon-2.1/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java
  
  Index: LinkStatusGenerator.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/generation/LinkStatusGenerator.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LinkStatusGenerator.java	8 Mar 2004 21:21:19 -0000	1.8
  +++ LinkStatusGenerator.java	28 Mar 2004 14:28:04 -0000	1.9
  @@ -24,7 +24,7 @@
   import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.Constants;
  -import org.apache.cocoon.util.Tokenizer;
  +import org.apache.commons.lang.StringUtils;
   import org.apache.regexp.RE;
   import org.apache.regexp.RESyntaxException;
   
  @@ -238,9 +238,9 @@
               for (int i = 0; i < children.length; i++) {
                   String pattern = children[i].getValue();
                   try {
  -                    Tokenizer t = new Tokenizer(pattern, ", ");
  -                    while (t.hasMoreTokens()) {
  -                        String tokenized_pattern = t.nextToken();
  +                    String params[] = StringUtils.split(pattern, ", ");
  +                    for (int index = 0; index < params.length; index++) {
  +                        String tokenized_pattern = params[index];
                           this.includeCrawlingURL.add(new RE(tokenized_pattern));
                       }
                   } catch (RESyntaxException rese) {
  @@ -256,9 +256,9 @@
               for (int i = 0; i < children.length; i++) {
                   String pattern = children[i].getValue();
                   try {
  -                    Tokenizer t = new Tokenizer(pattern, ", ");
  -                    while (t.hasMoreTokens()) {
  -                        String tokenized_pattern = t.nextToken();
  +                    String params[] = StringUtils.split(pattern, ", ");
  +                    for (int index = 0; index < params.length; index++) {
  +                        String tokenized_pattern = params[index];
                           this.excludeCrawlingURL.add(new RE(tokenized_pattern));
                       }
                   } catch (RESyntaxException rese) {
  
  
  
  1.10      +15 -22    cocoon-2.1/src/java/org/apache/cocoon/util/NetUtils.java
  
  Index: NetUtils.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/util/NetUtils.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NetUtils.java	5 Mar 2004 13:03:00 -0000	1.9
  +++ NetUtils.java	28 Mar 2004 14:28:04 -0000	1.10
  @@ -27,6 +27,7 @@
   
   import org.apache.excalibur.source.SourceParameters;
   import org.apache.cocoon.environment.Request;
  +import org.apache.commons.lang.StringUtils;
   
   /**
    * A collection of <code>File</code>, <code>URL</code> and filename
  @@ -195,7 +196,6 @@
                   buf.reset();
               }
           }
  -
           return rewrittenPath.toString();
       }
   
  @@ -256,23 +256,16 @@
        * @return The absolutized resource path
        */
       public static String absolutize(String path, String resource) {
  -        if (path == null || path.length() == 0) {
  -            // Base path is empty
  +        if (StringUtils.isEmpty(path)) {
               return resource;
  -        }
  -        
  -        if (resource == null || resource.length() == 0) {
  -            // Resource path is empty
  +        } else if (StringUtils.isEmpty(resource)) {
               return path;
  -        }
  -
  -        if (resource.charAt(0) == '/') {
  +        } else if (resource.charAt(0) == '/') {
               // Resource path is already absolute
               return resource;
           }
  -        
  -        int length = path.length() - 1;
  -        boolean slash = (path.charAt(length) == '/');
  +
  +        boolean slash = (path.charAt(path.length() - 1) == '/');
           
           StringBuffer b = new StringBuffer();
           b.append(path);
  @@ -291,27 +284,27 @@
        * @return the resource relative to the given path
        */
       public static String relativize(String path, String absoluteResource) {
  -        if (path == null || "".equals(path)) {
  +        if (StringUtils.isEmpty(path)) {
               return absoluteResource;
           }
  -        
  +
           if (path.charAt(path.length() - 1) != '/') {
               path += "/";
           }
  -        
  +
           if (absoluteResource.startsWith(path)) {
               // resource is direct descentant
               return absoluteResource.substring(path.length());
           } else {
               // resource is not direct descendant
  -            int index = StringUtils.matchStrings(path, absoluteResource);
  +            int index = StringUtils.indexOfDifference(path, absoluteResource);
               if (index > 0 && path.charAt(index-1) != '/') {
                   index = path.substring(0, index).lastIndexOf('/');
                   index++;
               }
               String pathDiff = path.substring(index);
               String resource = absoluteResource.substring(index);
  -            int levels = StringUtils.count(pathDiff, '/');
  +            int levels = StringUtils.countMatches(pathDiff, "/");
               StringBuffer b = new StringBuffer();
               for (int i = 0; i < levels; i++) {
                   b.append("../");
  @@ -328,7 +321,7 @@
        * @return The normalized uri
        */
       public static String normalize(String uri) {
  -        String[] dirty = StringUtils.split(uri, "/");
  +        String[] dirty = StringUtils.split(uri, '/');
           int length = dirty.length;
           String[] clean = new String[length];
   
  @@ -384,8 +377,8 @@
           if (i == -1) {
               return uri;
           }
  -        
  -        String[] params = StringUtils.split(uri.substring(i + 1), "&");
  +
  +        String[] params = StringUtils.split(uri.substring(i + 1), '&');
           for (int j = 0; j < params.length; j++) {
               String p = params[j];
               int k = p.indexOf('=');
  
  
  
  1.3       +2 -1      cocoon-2.1/src/java/org/apache/cocoon/util/Tokenizer.java
  
  Index: Tokenizer.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/util/Tokenizer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Tokenizer.java	5 Mar 2004 13:03:00 -0000	1.2
  +++ Tokenizer.java	28 Mar 2004 14:28:04 -0000	1.3
  @@ -24,6 +24,7 @@
    *
    * @author <A HREF="mailto:moravek@pobox.sk">Peter Moravek</A>
    * @version CVS $Id$
  + * @deprecated Use methos from org.apache.commons.lang instead
    */
   public class Tokenizer implements Enumeration {
   
  
  
  
  1.4       +3 -2      cocoon-2.1/src/java/org/apache/cocoon/util/IOUtils.java
  
  Index: IOUtils.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/util/IOUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IOUtils.java	5 Mar 2004 13:03:00 -0000	1.3
  +++ IOUtils.java	28 Mar 2004 14:28:04 -0000	1.4
  @@ -32,6 +32,7 @@
   import java.util.Arrays;
   import java.util.Locale;
   
  +import org.apache.commons.lang.StringUtils;
   import org.apache.log.Hierarchy;
   
   /**
  @@ -227,7 +228,7 @@
             buffer.append('_');
   
           for (int j = 0; j < chars.length; j++) {
  -          if (StringUtils.isAlphaNumeric(chars[j])) {
  +          if (org.apache.cocoon.util.StringUtils.isAlphaNumeric(chars[j])) {
               buffer.append(chars[j]);
             } else {
               buffer.append('_');
  
  
  
  1.3       +9 -21     cocoon-2.1/src/java/org/apache/cocoon/util/StringUtils.java
  
  Index: StringUtils.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/util/StringUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringUtils.java	5 Mar 2004 13:03:00 -0000	1.2
  +++ StringUtils.java	28 Mar 2004 14:28:04 -0000	1.3
  @@ -15,8 +15,6 @@
    */
   package org.apache.cocoon.util;
   
  -
  -
   /**
    * A collection of <code>String</code> handling utility methods.
    *
  @@ -33,7 +31,7 @@
        * @return An array of whitespace-separated tokens
        */
       public static String[] split(String line) {
  -        return split(line, " \t\n\r");
  +        return org.apache.commons.lang.StringUtils.split(line, " \t\n\r");
       }
   
       /**
  @@ -42,9 +40,11 @@
        * @param line The string to be split
        * @param delimiter A string containing token separators
        * @return An array of token
  +     * @deprecated Use org.apache.commons.lang.StringUtils.split() instead
        */
       public static String[] split(String line, String delimiter) {
  -        return Tokenizer.tokenize(line, delimiter, false);
  +        return org.apache.commons.lang.StringUtils.split(line, delimiter);
  +        //return Tokenizer.tokenize(line, delimiter, false);
       }
   
       /**
  @@ -67,14 +67,10 @@
        * @param str The string to be tested
        * @param c the char to be counted
        * @return the occurrence of the character in the string.
  +     * @deprecated Use org.apache.commons.lang.StringUtils.countMatches
        */
       public static int count(String str, char c) {
  -        int index = 0;
  -        char[] chars = str.toCharArray();
  -        for (int i = 0; i < chars.length; i++) {
  -            if (chars[i] == c) index++;
  -        }
  -        return index;
  +        return org.apache.commons.lang.StringUtils.countMatches(str, String.valueOf(c));
       }
   
       /**
  @@ -83,18 +79,10 @@
        * @param a The first string
        * @param b The second string
        * @return the index where the two strings stop matching starting from 0
  +     * @deprecated Use org.apache.commons.lang.StringUtils.indexOfDifference()
        */
       public static int matchStrings(String a, String b) {
  -        int i;
  -        char[] ca = a.toCharArray();
  -        char[] cb = b.toCharArray();
  -        int len = ( ca.length < cb.length ) ? ca.length : cb.length;
  -
  -        for (i = 0; i < len; i++) {
  -            if (ca[i] != cb[i]) break;
  -        }
  -
  -        return i;
  +        return org.apache.commons.lang.StringUtils.indexOfDifference(a, b);
       }
   
       /**
  
  
  
  1.2       +9 -32     cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPUtil.java
  
  Index: XSPUtil.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/XSPUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSPUtil.java	10 Mar 2004 12:58:05 -0000	1.1
  +++ XSPUtil.java	28 Mar 2004 14:28:04 -0000	1.2
  @@ -24,8 +24,9 @@
   import org.apache.cocoon.environment.Session;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.util.NetUtils;
  -import org.apache.cocoon.util.Tokenizer;
   import org.apache.cocoon.xml.IncludeXMLConsumer;
  +import org.apache.commons.lang.StringEscapeUtils;
  +import org.apache.commons.lang.StringUtils;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.xml.sax.SAXParser;
   import org.xml.sax.ContentHandler;
  @@ -121,39 +122,15 @@
       }
   
       public static String[] split(String line) {
  -        return split(line, " \t\r\f\n");
  +        return StringUtils.split(line, " \t\r\f\n");
       }
   
       public static String[] split(String line, String delimiter) {
  -        Tokenizer tokenizer = new Tokenizer(line, delimiter);
  -        int tokenCount = tokenizer.countTokens();
  -        String[] result = new String[tokenCount];
  -        for (int i = 0; i < tokenCount; i++) {
  -            result[i] = tokenizer.nextToken();
  -        }
  -        return result;
  +        return StringUtils.split(line, delimiter);
       }
   
       public static String encodeMarkup(String string) {
  -        char[] array = string.toCharArray();
  -        StringBuffer buffer = new StringBuffer();
  -        for (int i = 0; i < array.length; i++) {
  -            switch (array[i]) {
  -                case '<':
  -                    buffer.append("&lt;");
  -                    break;
  -                case '>':
  -                    buffer.append("&gt;");
  -                    break;
  -                case '&':
  -                    buffer.append("&amp;");
  -                    break;
  -                default:
  -                    buffer.append(array[i]);
  -                    break;
  -            }
  -        }
  -        return buffer.toString();
  +        return StringEscapeUtils.escapeXml(string);
       }
   
       public static String formEncode(String text) throws Exception {
  @@ -169,7 +146,7 @@
   
       // Date
       public static String formatDate(Date date, String pattern) {
  -        if (pattern == null || pattern.length() == 0) {
  +        if (StringUtils.isEmpty(pattern)) {
               pattern = "yyyy/MM/dd hh:mm:ss aa";
           }
           try {
  @@ -214,7 +191,7 @@
       }
   
       public static String getSourceContents(String uri, String base, SourceResolver resolver)
throws IOException {
  -        if (base != null && base.length() == 0) {
  +        if (StringUtils.isEmpty(base)) {
               base = null;
           }
           Source source = resolver.resolveURI(uri, base, null);
  @@ -257,7 +234,7 @@
   
       public static void includeSource(String uri, String base, SourceResolver resolver,
ContentHandler contentHandler)
               throws RuntimeException {
  -        if (base != null && base.length() == 0) {
  +        if (StringUtils.isEmpty(base)) {
               base = null;
           }
           Source source = null;
  
  
  
  1.19      +7 -27     cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/transformation/SQLTransformer.java
  
  Index: SQLTransformer.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/transformation/SQLTransformer.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SQLTransformer.java	16 Mar 2004 10:35:33 -0000	1.18
  +++ SQLTransformer.java	28 Mar 2004 14:28:04 -0000	1.19
  @@ -51,8 +51,8 @@
   import org.apache.cocoon.components.sax.XMLDeserializer;
   import org.apache.cocoon.components.sax.XMLSerializer;
   import org.apache.cocoon.environment.SourceResolver;
  -import org.apache.cocoon.util.Tokenizer;
   import org.apache.cocoon.xml.IncludeXMLConsumer;
  +import org.apache.commons.lang.StringEscapeUtils;
   import org.apache.commons.lang.StringUtils;
   import org.apache.excalibur.xml.sax.SAXParser;
   import org.xml.sax.Attributes;
  @@ -547,7 +547,7 @@
                   }
                   String substitute = parameters.getParameter( name, null );
                   //escape single quote
  -                substitute = replaceCharWithString( substitute, '\'', "''" );
  +                substitute = StringEscapeUtils.escapeSql(substitute);
                   if (getLogger().isDebugEnabled()) {
                       getLogger().debug( "SUBSTITUTE VALUE " + substitute );
                   }
  @@ -598,8 +598,8 @@
           case SQLTransformer.STATE_INSIDE_ESCAPE_STRING:
               String value = this.endTextRecording();
               if ( value.length() > 0 ) {
  -                value = replaceCharWithString( value, '\'', "''" );
  -                value = replaceCharWithString( value, '\\', "\\\\" );
  +                value = StringEscapeUtils.escapeSql(value);
  +                value = StringUtils.replace( value, "\\", "\\\\" );
                   this.getCurrentQuery().addQueryPart( value );
                   if (getLogger().isDebugEnabled()) {
                       getLogger().debug( "QUERY IS \"" + value + "\"" );
  @@ -669,25 +669,6 @@
           return (Query) queries.elementAt( i );
       }
   
  -    private String replaceCharWithString( String in, char c, String with ) {
  -        Tokenizer tok;
  -        StringBuffer replaced = null;
  -        if ( in.indexOf( c ) > -1 ) {
  -            tok = new Tokenizer( in, c );
  -            replaced = new StringBuffer();
  -            while ( tok.hasMoreTokens() ) {
  -                replaced.append( tok.nextToken() );
  -                if ( tok.hasMoreTokens() )
  -                    replaced.append( with );
  -            }
  -        }
  -        if ( replaced != null ) {
  -            return replaced.toString();
  -        } else {
  -            return in;
  -        }
  -    }
  -
       /**
        * Qualifies an element name by giving it a prefix.
        * @param name the element name
  @@ -695,10 +676,10 @@
        * @return a namespace qualified name that is correct
        */
       protected String nsQualify( String name, String prefix ) {
  -        if ( name == null || "".equals( name ) ) {
  +        if (StringUtils.isEmpty(name)) {
               return name;
           }
  -        if ( prefix != null && !"".equals( prefix ) ) {
  +        if (StringUtils.isNotEmpty(prefix)) {
               return new StringBuffer( prefix ).append( ":" ).append( name ).toString();
           } else {
               return name;
  @@ -1365,5 +1346,4 @@
               this.name = name;
           }
       }
  -
   }
  
  
  
  1.10      +3 -3      cocoon-2.1/src/java/org/apache/cocoon/acting/AbstractValidatorAction.java
  
  Index: AbstractValidatorAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/acting/AbstractValidatorAction.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractValidatorAction.java	16 Mar 2004 21:38:30 -0000	1.9
  +++ AbstractValidatorAction.java	28 Mar 2004 14:28:04 -0000	1.10
  @@ -26,7 +26,7 @@
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.sitemap.SitemapParameters;
  -import org.apache.cocoon.util.Tokenizer;
  +import org.apache.commons.lang.StringUtils;
   
   import org.apache.regexp.RE;
   import org.apache.regexp.RESyntaxException;
  @@ -949,7 +949,7 @@
           String[] rparams = null;
           Set set = new HashSet(20);
           if (!"*".equals(valstr.trim())) {
  -            rparams = Tokenizer.tokenize(valstr, ",", false);
  +            rparams = StringUtils.split(valstr, ","); 
               if (rparams != null) {
                   for (int i = rparams.length - 1; i >= 0; i--) {
                       set.add(desc.get(rparams[i]));
  
  
  
  1.7       +5 -6      cocoon-2.1/src/blocks/mail/java/org/apache/cocoon/acting/Sendmail.java
  
  Index: Sendmail.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/mail/java/org/apache/cocoon/acting/Sendmail.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Sendmail.java	5 Mar 2004 13:02:00 -0000	1.6
  +++ Sendmail.java	28 Mar 2004 14:28:04 -0000	1.7
  @@ -26,7 +26,7 @@
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.mail.MailMessageSender;
  -import org.apache.cocoon.util.Tokenizer;
  +import org.apache.commons.lang.StringUtils;
   
   import java.util.HashMap;
   import java.util.Map;
  @@ -192,10 +192,9 @@
               }
   
               if (parameters.isParameter("attachments")) {
  -                Tokenizer tz = new Tokenizer(parameters.getParameter("attachments"));
  -
  -                while (tz.hasMoreTokens()) {
  -                    String srcName = tz.nextToken();
  +                String fileName[] = StringUtils.split(parameters.getParameter("attachments"));
  +                for (int i = 0; i < fileName.length; i++) {
  +                    String srcName = fileName[i];
   
                       if (srcName.indexOf(":") == -1) {
                           Object obj = request.get(srcName);
  
  
  
  1.8       +12 -12    cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/components/search/SimpleLuceneXMLIndexerImpl.java
  
  Index: SimpleLuceneXMLIndexerImpl.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/components/search/SimpleLuceneXMLIndexerImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SimpleLuceneXMLIndexerImpl.java	5 Mar 2004 13:01:59 -0000	1.7
  +++ SimpleLuceneXMLIndexerImpl.java	28 Mar 2004 14:28:04 -0000	1.8
  @@ -24,7 +24,7 @@
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.util.Tokenizer;
  +import org.apache.commons.lang.StringUtils;
   import org.apache.excalibur.xml.sax.SAXParser;
   import org.apache.lucene.document.DateField;
   import org.apache.lucene.document.Document;
  @@ -144,16 +144,16 @@
               fieldTags = new HashSet();
               for (int i = 0; i < children.length; i++) {
                   String pattern = children[i].getValue();
  - 								Tokenizer t = new Tokenizer(pattern, ", ");
  -								while (t.hasMoreTokens()) {
  -										String tokenized_pattern = t.nextToken();
  -										if (!tokenized_pattern.equals("")) {
  -											this.fieldTags.add(tokenized_pattern);
  -											if (getLogger().isDebugEnabled()) {
  -													getLogger().debug("add field: " + tokenized_pattern);
  -											}
  -										}
  -								}
  +                String params[] = StringUtils.split(pattern, ", ");
  +                for (int index = 0; index < params.length; index++) {
  +                    String tokenized_pattern = params[index];
  +					if (!tokenized_pattern.equals("")) {
  +						this.fieldTags.add(tokenized_pattern);
  +						if (getLogger().isDebugEnabled()) {
  +								getLogger().debug("add field: " + tokenized_pattern);
  +						}
  +					}
  +    			}
               }
           } else {
               if (getLogger().isDebugEnabled()) {
  
  
  

Mime
View raw message