You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2023/03/24 18:44:03 UTC
[jspwiki] branch master updated: Avoid use File Stream. The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses.
This is an automated email from the ASF dual-hosted git repository.
juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git
The following commit(s) were added to refs/heads/master by this push:
new 7ae1b1d49 Avoid use File Stream. The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses.
7ae1b1d49 is described below
commit 7ae1b1d49056c157a90ef06663ad8cd3918393c4
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Mon Oct 17 21:41:17 2022 +0200
Avoid use File Stream. The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses.
---
jspwiki-util/src/main/java/org/apache/wiki/util/PropertyReader.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/jspwiki-util/src/main/java/org/apache/wiki/util/PropertyReader.java b/jspwiki-util/src/main/java/org/apache/wiki/util/PropertyReader.java
index b2466ef19..3d1b27d9a 100644
--- a/jspwiki-util/src/main/java/org/apache/wiki/util/PropertyReader.java
+++ b/jspwiki-util/src/main/java/org/apache/wiki/util/PropertyReader.java
@@ -25,6 +25,7 @@ import org.apache.logging.log4j.Logger;
import javax.servlet.ServletContext;
import java.io.*;
+import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
import java.nio.file.Files;
@@ -256,7 +257,7 @@ public final class PropertyReader {
break;
}
- try( final InputStream propertyStream = new FileInputStream( propertyFile ) ) {
+ try( final InputStream propertyStream = Files.newInputStream(Paths.get(( propertyFile ) ))) {
LOG.info( " Reading additional properties from " + propertyFile + " and merge to cascade." );
final Properties additionalProps = new Properties();
additionalProps.load( propertyStream );