Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4965549

URLConnection.connect: misleading IOE diagnostics message

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_7

      Description



      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
      ======================================================================

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: