Fix SpotBugs [ERROR]
High: Found reliance on default encoding in org.apache.commons.logging.LogFactory.initDiagnostics(): new java.io.PrintStream(OutputStream) [org.apache.commons.logging.LogFactory] At LogFactory.java:[line 1205] DM_DEFAULT_ENCODING.
This commit is contained in:
@@ -92,6 +92,9 @@ The <action> type attribute can be add,update,fix,remove.
|
||||
<action type="fix" dev="ggregory" due-to="Gary Gregory">
|
||||
Deprecate LogConfigurationException.cause in favor of getCause().
|
||||
</action>
|
||||
<action type="fix" dev="ggregory" due-to="Gary Gregory">
|
||||
Fix SpotBugs [ERROR] High: Found reliance on default encoding in org.apache.commons.logging.LogFactory.initDiagnostics(): new java.io.PrintStream(OutputStream) [org.apache.commons.logging.LogFactory] At LogFactory.java:[line 1205] DM_DEFAULT_ENCODING.
|
||||
</action>
|
||||
<!-- UPDATE -->
|
||||
<action dev="ggregory" type="update" due-to="Gary Gregory">
|
||||
Bump Java from 6 to 8.
|
||||
|
||||
@@ -24,6 +24,8 @@ import java.io.PrintStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Enumeration;
|
||||
@@ -1202,7 +1204,7 @@ public abstract class LogFactory {
|
||||
try {
|
||||
// open the file in append mode
|
||||
final FileOutputStream fos = new FileOutputStream(dest, true);
|
||||
return new PrintStream(fos);
|
||||
return new PrintStream(fos, false, StandardCharsets.UTF_8.name());
|
||||
} catch (final IOException ex) {
|
||||
// We should report this to the user - but how?
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user