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

Print this page




 406         Path parent = path.getParent();
 407         if (parent == null) {
 408             parent = path.toAbsolutePath().getParent();
 409         }
 410         return parent != null && Files.isWritable(parent);
 411     }
 412 
 413     /**
 414      * Open the set of output files, based on the configured
 415      * instance variables.
 416      */
 417     private void openFiles() throws IOException {
 418         LogManager manager = LogManager.getLogManager();
 419         manager.checkPermission();
 420         if (count < 1) {
 421            throw new IllegalArgumentException("file count = " + count);
 422         }
 423         if (limit < 0) {
 424             limit = 0;
 425         }





 426 
 427         // We register our own ErrorManager during initialization
 428         // so we can record exceptions.
 429         InitializationErrorManager em = new InitializationErrorManager();
 430         setErrorManager(em);
 431 
 432         // Create a lock file.  This grants us exclusive access
 433         // to our set of output files, as long as we are alive.
 434         int unique = -1;
 435         for (;;) {
 436             unique++;
 437             if (unique > MAX_LOCKS) {
 438                 throw new IOException("Couldn't get lock for " + pattern);
 439             }
 440             // Generate a lock file name from the "unique" int.
 441             lockFileName = generate(pattern, 0, unique).toString() + ".lck";
 442             // Now try to lock that filename.
 443             // Because some systems (e.g., Solaris) can only do file locks
 444             // between processes (and not within a process), we first check
 445             // if we ourself already have the file locked.




 406         Path parent = path.getParent();
 407         if (parent == null) {
 408             parent = path.toAbsolutePath().getParent();
 409         }
 410         return parent != null && Files.isWritable(parent);
 411     }
 412 
 413     /**
 414      * Open the set of output files, based on the configured
 415      * instance variables.
 416      */
 417     private void openFiles() throws IOException {
 418         LogManager manager = LogManager.getLogManager();
 419         manager.checkPermission();
 420         if (count < 1) {
 421            throw new IllegalArgumentException("file count = " + count);
 422         }
 423         if (limit < 0) {
 424             limit = 0;
 425         }
 426         if (pattern == null || pattern.isEmpty()) {
 427             // can only happen if the default constructor was called: all
 428             // other constructors will have thrown IAE.
 429             throw new NullPointerException();
 430         }
 431 
 432         // We register our own ErrorManager during initialization
 433         // so we can record exceptions.
 434         InitializationErrorManager em = new InitializationErrorManager();
 435         setErrorManager(em);
 436 
 437         // Create a lock file.  This grants us exclusive access
 438         // to our set of output files, as long as we are alive.
 439         int unique = -1;
 440         for (;;) {
 441             unique++;
 442             if (unique > MAX_LOCKS) {
 443                 throw new IOException("Couldn't get lock for " + pattern);
 444             }
 445             // Generate a lock file name from the "unique" int.
 446             lockFileName = generate(pattern, 0, unique).toString() + ".lck";
 447             // Now try to lock that filename.
 448             // Because some systems (e.g., Solaris) can only do file locks
 449             // between processes (and not within a process), we first check
 450             // if we ourself already have the file locked.