OSDN Git Service

MOD: Catch BindException it detail of IOException.
authorTakuya Ono <takuya-o@users.sourceforge.jp>
Thu, 16 Aug 2007 16:48:47 +0000 (16:48 +0000)
committerTakuya Ono <takuya-o@users.sourceforge.jp>
Thu, 16 Aug 2007 16:48:47 +0000 (16:48 +0000)
src/org/jent/checksmtp/SMTPclient.java

index d72e5b0..b54ac54 100644 (file)
@@ -1,6 +1,7 @@
 package org.jent.checksmtp;
 
 import java.io.IOException;
+import java.net.BindException;
 
 import java.net.InetAddress;
 import java.net.ServerSocket;
@@ -54,10 +55,18 @@ public class SMTPclient implements Runnable {
                     InetAddress.getByAddress(
                     new byte[] { 127, 0, 0, 1 }));
           }
+        } catch (BindException bindEx) {
+          //fatalError = true;
+          String errorMessage = "Recive Port bind error. " + bindEx.getMessage();
+          System.err.println(errorMessage);
+          bindEx.printStackTrace();
+          new MessageDialogUI(errorMessage, bindEx, MessageDialogUI.ERROR_MODE);
+          break;
         } catch (IOException e) {
           fatalError = true;
-          String errorMessage = "Fatal Error Occurred. Stop service.";
+          String errorMessage = "I/O Error Occurred. Stop service.";
           System.err.println(errorMessage);
+          e.printStackTrace();
           new MessageDialogUI(errorMessage, e, MessageDialogUI.ERROR_MODE);
           break;
         } catch (IllegalArgumentException iaEx) {
@@ -66,6 +75,7 @@ public class SMTPclient implements Runnable {
           String errorMessage = "Argument Error Occurted(" + iaEx.getMessage() +
                   "). Stop service.";
           System.err.println(errorMessage);
+          iaEx.printStackTrace();
           new MessageDialogUI(errorMessage, iaEx, MessageDialogUI.ERROR_MODE);
           break;
         }