You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2001/12/10 14:03:31 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/mail SmtpResponseReader.java
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>