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

LOGGING APIs: spec for FileHandler constructors should document IOException

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: elR10090 Date: 12/07/2000



      Logging APIs specification (draft 0.55) doesn't state constructors
      of the FileHandler class to throw IOException.

      The following simple test reveals that FileHandler constructors
      signature includes a "throws IOException".

      I think this is a spec bug the same as 4381189.

      Test.java source:

      import java.util.logging.*;

      class Test {

          public static void main(String args[]) {

              new FileHandler();
              new FileHandler("Test");
              new FileHandler("Test", 1024, 3);
              
          }

      }

      Test.java compilation log:

      Test.java:7: unreported exception java.io.IOException; must be caught or declared to be thrown
              new FileHandler();
              ^
      Test.java:8: unreported exception java.io.IOException; must be caught or declared to be thrown
              new FileHandler("Test");
              ^
      Test.java:9: unreported exception java.io.IOException; must be caught or declared to be thrown
              new FileHandler("Test", 1024, 3);
              ^
      3 errors

      ======================================================================

      Name: elR10090 Date: 12/13/2000


      The same problem occurs also for the following constructors:

          SocketHandler()
          SocketHandler(String, int)

      Source and log follows:

      import java.util.logging.*;

      class Test2 {

          public static void main(String args[]) {

              new SocketHandler();
              new SocketHandler("localhost", 777);
                      
          }

      }

      Test2.java:7: unreported exception java.io.IOException; must be caught or declared to be thrown
              new SocketHandler();
              ^
      Test2.java:8: unreported exception java.io.IOException; must be caught or declared to be thrown
              new SocketHandler("localhost", 777);
              ^
      2 errors



      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            ghamiltosunw Graham Hamilton (Inactive)
            Reporter:
            latkinsunw Latkin Latkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: