src/java.logging/share/classes/java/util/logging/FileHandler.java

Print this page

        

@@ -258,10 +258,15 @@
      * @exception  NullPointerException if pattern property is an empty String.
      */
     public FileHandler() throws IOException, SecurityException {
         checkPermission();
         configure();
+        // pattern will have been set by configure. check that it's not
+        // empty.
+        if (pattern.isEmpty()) {
+            throw new NullPointerException();
+        }
         openFiles();
     }
 
     /**
      * Initialize a <tt>FileHandler</tt> to write to the given filename.

@@ -422,10 +427,14 @@
         }
         if (limit < 0) {
             limit = 0;
         }
 
+        // All constructors check that pattern is neither null nor empty.
+        assert pattern != null : "pattern should not be null";
+        assert !pattern.isEmpty() : "pattern should not be empty";
+
         // We register our own ErrorManager during initialization
         // so we can record exceptions.
         InitializationErrorManager em = new InitializationErrorManager();
         setErrorManager(em);