JWS-128 patch out log4j references in the compbio.FileUtil class, and corresponding... JABAWS_RELEASE_2_2_1
authorJim Procter <j.procter@dundee.ac.uk>
Tue, 10 May 2022 11:26:35 +0000 (12:26 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Tue, 10 May 2022 11:26:35 +0000 (12:26 +0100)
compbio-utils/compbio/util/FileUtil.java
engine/compbio/engine/client/ConfExecutable.java
engine/compbio/engine/client/EngineUtil.java
engine/compbio/engine/client/Util.java
engine/compbio/engine/local/ExecutableWrapper.java

index 7456a05..dc10637 100644 (file)
@@ -204,7 +204,7 @@ public class FileUtil {
                try {\r
                        out.close();\r
                } finally {\r
-                       closeSilently(log, out);\r
+                       closeSilently(out);\r
                }\r
                return file;\r
        }\r
@@ -228,9 +228,9 @@ public class FileUtil {
                        bis.close();\r
                        inStream.close();\r
                } finally {\r
-                       closeSilently(log, out);\r
-                       closeSilently(log, bis);\r
-                       closeSilently(log, inStream);\r
+                       closeSilently(out);\r
+                       closeSilently(bis);\r
+                       closeSilently(inStream);\r
                }\r
                return result;\r
        }\r
@@ -245,7 +245,7 @@ public class FileUtil {
                try {\r
                        contentStr.close();\r
                } finally {\r
-                       closeSilently(log, contentStr);\r
+                       closeSilently(contentStr);\r
                }\r
                return content;\r
        }\r
@@ -287,8 +287,8 @@ public class FileUtil {
                                br.close();\r
                                reader.close();\r
                        } finally {\r
-                               closeSilently(log, br);\r
-                               closeSilently(log, reader);\r
+                               closeSilently(br);\r
+                               closeSilently(reader);\r
                        }\r
                }\r
                return fileStr;\r
@@ -313,8 +313,8 @@ public class FileUtil {
                        bw.close();\r
                        fwriter.close();\r
                } finally {\r
-                       closeSilently(log, bw);\r
-                       closeSilently(log, fwriter);\r
+                       closeSilently(bw);\r
+                       closeSilently(fwriter);\r
                }\r
        }\r
 \r
@@ -337,8 +337,8 @@ public class FileUtil {
                        bw.close();\r
                        outStream.close();\r
                } finally {\r
-                       closeSilently(log, bw);\r
-                       closeSilently(log, outStream);\r
+                       closeSilently(bw);\r
+                       closeSilently(outStream);\r
                }\r
        }\r
 \r
@@ -366,23 +366,13 @@ public class FileUtil {
                return Arrays.asList(new File(path).list(filter));\r
        }\r
 \r
-       public final static void closeSilently(Logger log, Closeable stream) {\r
-               if (stream != null) {\r
-                       try {\r
-                               stream.close();\r
-                       } catch (IOException e) {\r
-                               log.warning(e.getLocalizedMessage() + " Cause \n"+e.getCause());\r
-                       }\r
-               }\r
-       }\r
-\r
 \r
        public final static void closeSilently(Closeable stream) {\r
                if (stream != null) {\r
                        try {\r
                                stream.close();\r
                        } catch (IOException e) {\r
-                               log.warning(e.getLocalizedMessage()+" Cause \n"+e.getCause());\r
+                               System.err.println(e.getLocalizedMessage()+" Cause \n"+e.getCause());\r
                        }\r
                }\r
        }\r
index dcce7d2..bd24840 100644 (file)
@@ -276,7 +276,7 @@ public class ConfExecutable<T> implements ConfiguredExecutable<T> {
                } catch (JAXBException e) {\r
                        log.warning(e.getLocalizedMessage()+" Caused by\n"+e.getCause());\r
                } finally {\r
-                       FileUtil.closeSilently(log, confFileStream);\r
+                       FileUtil.closeSilently(confFileStream);\r
                }\r
                return rconf;\r
        }\r
index d5c30af..906745f 100644 (file)
@@ -99,7 +99,7 @@ public final class EngineUtil {
                                        + workDirectory + " for local execution! Ignoring... "\r
                                        + e.getMessage());\r
                } finally {\r
-                       FileUtil.closeSilently(log, writer);\r
+                       FileUtil.closeSilently(writer);\r
                }\r
        }\r
 \r
@@ -376,7 +376,7 @@ public final class EngineUtil {
                                        "Could not load run configuration!" + e.getMessage()+"\n"+\r
                                        e.getCause());\r
                } finally {\r
-                       FileUtil.closeSilently(log, fileInStream);\r
+                       FileUtil.closeSilently(fileInStream);\r
                }\r
                return exec;\r
        }\r
index c57596c..f558153 100644 (file)
@@ -99,7 +99,7 @@ public final class Util {
                                        + workDirectory + " for local execution! Ignoring... "
                                        + e.getMessage());
                } finally {
-                       FileUtil.closeSilently(log, writer);
+                       FileUtil.closeSilently(writer);
                }
        }
 
@@ -376,7 +376,7 @@ public final class Util {
                                        "Could not load run configuration!" + e.getMessage(),
                                        e.getCause());
                } finally {
-                       FileUtil.closeSilently(log, fileInStream);
+                       FileUtil.closeSilently(fileInStream);
                }
                return exec;
        }
index 1cdf9a4..dbf12ae 100644 (file)
@@ -209,8 +209,8 @@ public final class ExecutableWrapper implements
                        }\r
                        // hack - we probably lost log messages here.\r
                        java.util.logging.Logger logger = java.util.logging.Logger.getLogger(this.getClass().getCanonicalName());\r
-                       FileUtil.closeSilently(logger, errorStream);\r
-                       FileUtil.closeSilently(logger, outStream);\r
+                       FileUtil.closeSilently(errorStream);\r
+                       FileUtil.closeSilently(outStream);\r
                }\r
                return confExec;\r
        }\r