Blob Blame History Raw
diff -r 2b1af623e3a8 NEWS
--- a/NEWS	Thu Oct 08 12:11:49 2015 +0200
+++ b/NEWS	Wed Oct 14 10:37:54 2015 +0200
@@ -23,6 +23,7 @@
 * RH1231441 Unable to read the text of the buttons of the security dialogue
 * Fixed RH1233697 icedtea-web: applet origin spoofing
 * Fixed RH1233667 icedtea-web: unexpected permanent authorization of unsigned applets
+* fixed fatal impact of initialization error of FileLog
 * MissingALACAdialog made available also for unsigned applications (but ignoring actual manifest value) and fixed
 * NetX
   - fixed issues with -html shortcuts
diff -r 2b1af623e3a8 netx/net/sourceforge/jnlp/util/logging/FileLog.java
--- a/netx/net/sourceforge/jnlp/util/logging/FileLog.java	Thu Oct 08 12:11:49 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/logging/FileLog.java	Wed Oct 14 10:37:54 2015 +0200
@@ -60,21 +60,46 @@
     private final FileHandler fh;
     private static final String defaultloggerName = "IcedTea-Web file-logger";
 
-    public FileLog() {
+    
+    public static SingleStreamLogger createFileLog() {
+        SingleStreamLogger s;
+        try {
+            s = new FileLog();
+        } catch (Exception ex) {
+            //we do not wont to block whole logging just because initialization error in "new FileLog()"
+            OutputController.getLogger().log(ex);
+            s = new SingleStreamLogger() {
+
+                @Override
+                public void log(String s) {
+                    //dummy
+                }
+
+                @Override
+                public void close() {
+                    //dummy
+                }
+            };
+        }
+        return s;
+    }
+    
+    private FileLog() {
         this(false);
     }
     
-     public FileLog(boolean append) {
+     private FileLog(boolean append) {
         this(defaultloggerName, LogConfig.getLogConfig().getIcedteaLogDir() + "itw-javantx-" + getStamp() + ".log", append);
     }
 
 
-     
-    public FileLog(String fileName, boolean append) {
+    // testing constructor 
+    FileLog(String fileName, boolean append) {
         this(fileName, fileName, append);
     }
      
-    public FileLog(String loggerName, String fileName, boolean append) {
+    
+    private FileLog(String loggerName, String fileName, boolean append) {
        try {
            File futureFile = new File(fileName);
            if (!futureFile.exists()) {
@@ -106,6 +131,7 @@
         impl.log(Level.FINE, s);
     }
     
+    @Override
     public void close() {
         fh.close();
     }
diff -r 2b1af623e3a8 netx/net/sourceforge/jnlp/util/logging/OutputController.java
--- a/netx/net/sourceforge/jnlp/util/logging/OutputController.java	Thu Oct 08 12:11:49 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/logging/OutputController.java	Wed Oct 14 10:37:54 2015 +0200
@@ -333,9 +333,9 @@
         
         //https://en.wikipedia.org/wiki/Double-checked_locking#Usage_in_Java
         //https://en.wikipedia.org/wiki/Initialization_on_demand_holder_idiom
-        private static volatile FileLog INSTANCE = new FileLog();
+        private static volatile SingleStreamLogger INSTANCE = FileLog.createFileLog();
     }
-    private FileLog getFileLog() {
+    private SingleStreamLogger getFileLog() {
         return FileLogHolder.INSTANCE;
     }
 
diff -r 2b1af623e3a8 netx/net/sourceforge/jnlp/util/logging/PrintStreamLogger.java
--- a/netx/net/sourceforge/jnlp/util/logging/PrintStreamLogger.java	Thu Oct 08 12:11:49 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/logging/PrintStreamLogger.java	Wed Oct 14 10:37:54 2015 +0200
@@ -58,6 +58,11 @@
     public void setStream(PrintStream stream) {
         this.stream = stream;
     }
+
+    @Override
+    public void close() {
+        stream.flush();
+    }
     
     
  
diff -r 2b1af623e3a8 netx/net/sourceforge/jnlp/util/logging/SingleStreamLogger.java
--- a/netx/net/sourceforge/jnlp/util/logging/SingleStreamLogger.java	Thu Oct 08 12:11:49 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/logging/SingleStreamLogger.java	Wed Oct 14 10:37:54 2015 +0200
@@ -41,6 +41,7 @@
     
      
       public  void log(String s);
+      public void close();
 
 
 }
diff -r 2b1af623e3a8 netx/net/sourceforge/jnlp/util/logging/UnixSystemLog.java
--- a/netx/net/sourceforge/jnlp/util/logging/UnixSystemLog.java	Thu Oct 08 12:11:49 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/logging/UnixSystemLog.java	Wed Oct 14 10:37:54 2015 +0200
@@ -63,6 +63,11 @@
             OutputController.getLogger().log(ex);
         }
     }
+
+    @Override
+    public void close() {
+        //nope
+    }
     
 
 }
diff -r 2b1af623e3a8 netx/net/sourceforge/jnlp/util/logging/WinSystemLog.java
--- a/netx/net/sourceforge/jnlp/util/logging/WinSystemLog.java	Thu Oct 08 12:11:49 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/logging/WinSystemLog.java	Wed Oct 14 10:37:54 2015 +0200
@@ -49,9 +49,10 @@
     public void log(String s) {
      //not yet implemented   
     }
- 
-    
       
-
+    @Override
+    public void close() {
+        //nope
+    }
 
 }
diff -r 2b1af623e3a8 netx/net/sourceforge/jnlp/util/logging/headers/PluginMessage.java
--- a/netx/net/sourceforge/jnlp/util/logging/headers/PluginMessage.java	Thu Oct 08 12:11:49 2015 +0200
+++ b/netx/net/sourceforge/jnlp/util/logging/headers/PluginMessage.java	Wed Oct 14 10:37:54 2015 +0200
@@ -38,7 +38,6 @@
 package net.sourceforge.jnlp.util.logging.headers;
 
 import java.util.Date;
-import net.sourceforge.jnlp.util.logging.FileLog;
 import net.sourceforge.jnlp.util.logging.OutputController;
 
 public class PluginMessage  implements MessageWithHeader{