cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/source SitemapSource.java
Date Fri, 19 Apr 2002 23:48:41 GMT
vgritsenko    02/04/19 16:48:41

  Modified:    src/java/org/apache/cocoon/components/source
                        SitemapSource.java
  Log:
  reduce amount of substring() calls
  
  Revision  Changes    Path
  1.11      +13 -12    xml-cocoon2/src/java/org/apache/cocoon/components/source/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/SitemapSource.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SitemapSource.java	11 Apr 2002 15:05:25 -0000	1.10
  +++ SitemapSource.java	19 Apr 2002 23:48:40 -0000	1.11
  @@ -89,7 +89,7 @@
    * Description of a source which is defined by a pipeline.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Id: SitemapSource.java,v 1.10 2002/04/11 15:05:25 sylvain Exp $
  + * @version CVS $Id: SitemapSource.java,v 1.11 2002/04/19 23:48:40 vgritsenko Exp $
    */
   
   public final class SitemapSource
  @@ -147,19 +147,18 @@
           boolean rawMode = false;
   
           // remove the protocol
  -        int protocolEnd = uri.indexOf(':');
  -        if (protocolEnd != -1) {
  -            uri = uri.substring(protocolEnd + 1);
  +        int position = uri.indexOf(':') + 1;
  +        if (position != 0) {
               // check for subprotocol
  -            if (uri.startsWith("raw:")) {
  -                uri = uri.substring(4);
  +            if (uri.startsWith("raw:", position)) {
  +                position += 4;
                   rawMode = true;
               }
           }
   
           // does the uri point to this sitemap or to the root sitemap?
  -        if (uri.startsWith("//")) {
  -            uri = uri.substring(2);
  +        if (uri.startsWith("//", position)) {
  +            position += 2;
               Processor processor = null;
               try {
                   processor = (Processor)this.manager.lookup(Processor.ROLE);
  @@ -168,8 +167,8 @@
               }
               this.prefix = ""; // start at the root
               this.processor = processor;
  -        } else if (uri.startsWith("/")) {
  -            uri = uri.substring(1);
  +        } else if (uri.startsWith("/", position)) {
  +            position ++;
               this.prefix = null;
               this.processor = sitemap;
           } else {
  @@ -178,10 +177,12 @@
   
           // create the queryString (if available)
           String queryString = null;
  -        int queryStringPos = uri.indexOf('?');
  +        int queryStringPos = uri.indexOf('?', position);
           if (queryStringPos != -1) {
               queryString = uri.substring(queryStringPos + 1);
  -            uri = uri.substring(0, queryStringPos);
  +            uri = uri.substring(position, queryStringPos);
  +        } else if (position > 0) {
  +            uri = uri.substring(position);
           }
   
           // build the request uri which is relative to the context
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message