new InputStreamReader(s.getInputStream()));
PrintWriter pw = new PrintWriter(s.getOutputStream())) {
String line;
- while ((line = br.readLine()).startsWith("220-")) {
+ while ((line = br.readLine()) != null
+ && line.startsWith("220-")) {
}
-
- if (!line.startsWith("220")) {
+ if (line == null || !line.startsWith("220")) {
continue;
}
pw.print("HELO www.cacert.org\r\n");
pw.flush();
- while ((line = br.readLine()).startsWith("220")) {
+ while ((line = br.readLine()) != null
+ && line.startsWith("220")) {
}
- if (!line.startsWith("250")) {
+ if (line == null || !line.startsWith("250")) {
continue;
}
pw.print("MAIL FROM: <returns@cacert.org>\r\n");
line = br.readLine();
- if (!line.startsWith("250")) {
+ if (line == null || !line.startsWith("250")) {
continue;
}
pw.print("RCPT TO: <" + address + ">\r\n");
e.printStackTrace();
}
- if (!line.startsWith("250")) {
+ if (line == null || !line.startsWith("250")) {
return line;
} else {
return OK;