ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/mail SmtpResponseReader.java
Date Mon, 10 Dec 2001 13:03:31 GMT
bodewig     01/12/10 05:03:31

  Modified:    src/main/org/apache/tools/mail SmtpResponseReader.java
  Log:
  perform some sanity checks on mail servers response.
  
  PR: 5273 (but probably doesn't fix it)
  
  Revision  Changes    Path
  1.5       +6 -4      jakarta-ant/src/main/org/apache/tools/mail/SmtpResponseReader.java
  
  Index: SmtpResponseReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/mail/SmtpResponseReader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SmtpResponseReader.java	2001/10/28 21:31:00	1.4
  +++ SmtpResponseReader.java	2001/12/10 13:03:31	1.5
  @@ -86,7 +86,7 @@
       public String getResponse() throws IOException {
           result.setLength(0);
           String line = reader.readLine();
  -        if (line != null) {
  +        if (line != null && line.length() >= 3) {
               result.append(line.substring(0, 3));
               result.append(" ");
           }
  @@ -112,14 +112,16 @@
        * Should we expect more input?
        */
       protected boolean hasMoreLines(String line) {
  -        return line.charAt(3) == '-';
  +        return line.length() > 3 && line.charAt(3) == '-';
       }
   
       /**
        * Append the text from this line of the resonse.
        */
       private void append(String line) {
  -        result.append(line.substring(4));
  -        result.append(" ");
  +        if (line.length() > 4) {
  +            result.append(line.substring(4));
  +            result.append(" ");
  +        }
       }
   }
  
  
  

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


Mime
View raw message