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">
|
<action type="fix" dev="ggregory" due-to="Gary Gregory">
|
||||||
Deprecate LogConfigurationException.cause in favor of getCause().
|
Deprecate LogConfigurationException.cause in favor of getCause().
|
||||||
</action>
|
</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 -->
|
<!-- UPDATE -->
|
||||||
<action dev="ggregory" type="update" due-to="Gary Gregory">
|
<action dev="ggregory" type="update" due-to="Gary Gregory">
|
||||||
Bump Java from 6 to 8.
|
Bump Java from 6 to 8.
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import java.io.PrintStream;
|
|||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
@@ -1202,7 +1204,7 @@ public abstract class LogFactory {
|
|||||||
try {
|
try {
|
||||||
// open the file in append mode
|
// open the file in append mode
|
||||||
final FileOutputStream fos = new FileOutputStream(dest, true);
|
final FileOutputStream fos = new FileOutputStream(dest, true);
|
||||||
return new PrintStream(fos);
|
return new PrintStream(fos, false, StandardCharsets.UTF_8.name());
|
||||||
} catch (final IOException ex) {
|
} catch (final IOException ex) {
|
||||||
// We should report this to the user - but how?
|
// We should report this to the user - but how?
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user