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

[TESTBUG] java/net/CookieHandler/LocalHostCookie.java misplaced try/finally

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • core-libs
    • None
    • b108

      Test contains:

      Server s = null;
      try {
          s = new Server();
          s.startServer();
         ...
      } finally {
          s.stopServer();
      }

      If "new Server() throws an exception we hit the finally block, s is still null and we then throw NullPointerException instead of the real exception.

      The try block should at least start after "s = new Server();" and possibly after startServer() as well.

            msheppar Mark Sheppard
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: