URLConnection.connect: misleading IOE diagnostics message

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • None
    • Affects Version/s: 5.0
    • Component/s: core-libs
    • sparc
    • solaris_7



      Name: mtR10145 Date: 12/09/2003

      Code below illustrates that IOException message from
      URLConnection.coonect lacks mentioning that this is IOException
      namely java.net.ConnectException is mentioned instead). This can
      mislead application developer and make problems investigation more
      difficult.
      =================== Test.java ======================
      import java.net.*;
      import java.io.IOException;

      public class Test {

          public static void main(String argv[]) {
              URLConnection urlc = null;

              try {
                  urlc = new URL("https://foo.com").openConnection();
              } catch (IOException ioe) {
                  System.out.println("Unexpected: " + ioe);
              }

              try {
                  urlc.connect();
              } catch(SecurityException se) {
                  System.out.println("SecurityException thrown: " + se);
              } catch(java.io.IOException ioe) {
                  // the problem is here
                  System.out.println("IOException thrown: " + ioe);
              }
          }
      }
      ============== Test output with JSE 1.5.0-beta-b25 ==========
      IOException thrown: java.net.ConnectException: Connection refused: connect
      ======================================================================

            Assignee:
            Michael McMahon
            Reporter:
            Cms Cms (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: