avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject cvs commit: jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver FtpStatus.java
Date Thu, 10 Oct 2002 16:08:15 GMT
rana_b      2002/10/10 09:08:15

  Modified:    ftpserver/src/java/org/apache/avalon/ftpserver
                        FtpStatus.java
  Log:
  faster status string parsing
  
  Revision  Changes    Path
  1.7       +13 -5     jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/FtpStatus.java
  
  Index: FtpStatus.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/FtpStatus.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FtpStatus.java	20 May 2002 10:20:17 -0000	1.6
  +++ FtpStatus.java	10 Oct 2002 16:08:14 -0000	1.7
  @@ -112,9 +112,12 @@
           // replace variables
           int startIndex = 0;
           int openIndex = str.indexOf('{', startIndex);
  +        if (openIndex == -1) {
  +            return str;
  +        }
  +        
           int closeIndex = str.indexOf('}', startIndex);
  -
  -        if( (openIndex == -1) || (closeIndex == -1) || (openIndex > closeIndex) ) {
  +        if( (closeIndex == -1) || (openIndex > closeIndex) ) {
               return str;
           }
   
  @@ -126,9 +129,13 @@
   
               startIndex = closeIndex + 1;
               openIndex = str.indexOf('{', startIndex);
  +            if (openIndex == -1) {
  +                sb.append(str.substring(startIndex));
  +                break;
  +            }
  +            
               closeIndex = str.indexOf('}', startIndex);
  -
  -            if( (openIndex == -1) || (closeIndex == -1) || (openIndex > closeIndex)
) {
  +            if( (closeIndex == -1) || (openIndex > closeIndex) ) {
                  sb.append(str.substring(startIndex));
                  break;
               }
  @@ -182,4 +189,5 @@
           String strRes = getMessage(status, cmd, args);
           return processNewLine(strRes, status);
       }
  +    
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message