OSDN Git Service

Change IDE JDeveloper to NetBeans 5.5.
[mdc/BetaProject.git] / src / org / jent / checksmtp / Processer.java
index a540ce4..44fc230 100644 (file)
@@ -19,7 +19,7 @@ import java.util.ListIterator;
 import java.util.regex.Pattern;
 
 
-public class Processer implements Runnable {
+public class Processer implements Runnable, ResultNotify {
   private Socket client;
 
   //Conform status.
@@ -99,6 +99,7 @@ public class Processer implements Runnable {
       client = null;
     } catch (IOException e) {
       System.err.println("Execption occurred in Processer.");
+      //TODO: Display error Dialog.
       e.printStackTrace();
     } finally {
       //for failsafe Socket close.
@@ -116,6 +117,8 @@ public class Processer implements Runnable {
           //IGNORE close Exception
         }
       }
+      //LDAP Connection close.
+      LDAPSearch.close();
     }
   }
 
@@ -205,6 +208,12 @@ public class Processer implements Runnable {
           while (true) {
             line = clientReader.readLine();
 
+            if (line == null) {
+              //Finish client stream.
+              System.err.println("Client disconnected.");
+              break; //force disconnect.
+            }
+
             if (isRcptTo(line)) {
               //stored To: address.
               toList.add(formatToAddress(line));
@@ -222,7 +231,7 @@ public class Processer implements Runnable {
               }
 
               //checkout toList
-              new ToListDialog(this, toList);
+              new ToListUI(this, toList);
 
               while (result == RESULT_UNKNOWN) {
                 try {
@@ -235,7 +244,7 @@ public class Processer implements Runnable {
                 }
               }
 
-              if (result == RESULT_NG) {
+              if (result != RESULT_OK ) {
                 System.out.println("CANCEL sending mail.");
                 serverWriter.println(COMMAND_RESET);
                 line = serverReader.readLine(); //Server MUST retrun "250 OK"
@@ -249,6 +258,9 @@ public class Processer implements Runnable {
             break; // client read while(true);
           }
 
+          if (line == null ) {
+            break;
+          }
           serverWriter.println(line);
           System.out.println(line);
         }