Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47499
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 22 Sep 2009 21:16:54 +0000 (21:16 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 22 Sep 2009 21:16:54 +0000 (21:16 +0000)
Don't swallow BindException

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@817843 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/JIoEndpoint.java

index 3250596..62e2ce7 100644 (file)
@@ -233,12 +233,16 @@ public class JIoEndpoint extends AbstractEndpoint {
                 } else {
                     serverSocket = serverSocketFactory.createSocket(getPort(), getBacklog(), getAddress());
                 }
-            } catch (BindException be) {
+            } catch (BindException orig) {
+                String msg;
                 if (getAddress() == null)
-                    throw new BindException(be.getMessage() + "<null>:" + getPort());
+                    msg = orig.getMessage() + " <null>:" + getPort();
                 else
-                    throw new BindException(be.getMessage() + " " +
-                            getAddress().toString() + ":" + getPort());
+                    msg = orig.getMessage() + " " +
+                            getAddress().toString() + ":" + getPort();
+                BindException be = new BindException(msg);
+                be.initCause(orig);
+                throw be;
             }
         }
         //if( serverTimeout >= 0 )