You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/07/26 20:15:06 UTC
[commons-pool] branch master updated: SpotBugs: Explicitly use the
default Charset.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-pool.git
The following commit(s) were added to refs/heads/master by this push:
new 52b4e63 SpotBugs: Explicitly use the default Charset.
52b4e63 is described below
commit 52b4e6367a7711e3ce305ea4c376bd374d129698
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 26 16:14:58 2020 -0400
SpotBugs: Explicitly use the default Charset.
Instead of suppressing a SpotBugs error, make the code do what the
suppression says and "Use of default system encoding is deliberate
design choice."
---
findbugs-exclude-filter.xml | 6 ------
src/main/java/org/apache/commons/pool2/impl/AbandonedConfig.java | 8 +++++---
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml
index ab49c78..2f72f9d 100644
--- a/findbugs-exclude-filter.xml
+++ b/findbugs-exclude-filter.xml
@@ -46,12 +46,6 @@
<Bug code="REC" />
</Match>
<Match>
- <!-- Use of default system encoding is deliberate design choice -->
- <Class name="org.apache.commons.pool2.impl.AbandonedConfig" />
- <Method name="<init>" />
- <Bug pattern="DM_DEFAULT_ENCODING " />
- </Match>
- <Match>
<!-- compareTo() method carries the appropriate warning -->
<Class name="org.apache.commons.pool2.impl.DefaultPooledObject" />
<Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS " />
diff --git a/src/main/java/org/apache/commons/pool2/impl/AbandonedConfig.java b/src/main/java/org/apache/commons/pool2/impl/AbandonedConfig.java
index 6466a4d..85c1cc4 100644
--- a/src/main/java/org/apache/commons/pool2/impl/AbandonedConfig.java
+++ b/src/main/java/org/apache/commons/pool2/impl/AbandonedConfig.java
@@ -17,11 +17,13 @@
package org.apache.commons.pool2.impl;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.nio.charset.Charset;
+
import org.apache.commons.pool2.TrackedUse;
import org.apache.commons.pool2.UsageTracking;
-import java.io.PrintWriter;
-
/**
* Configuration settings for abandoned object removal.
*
@@ -210,7 +212,7 @@ public class AbandonedConfig {
* PrintWriter to use to log information on abandoned objects.
* Use of default system encoding is deliberate.
*/
- private PrintWriter logWriter = new PrintWriter(System.out);
+ private PrintWriter logWriter = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()));
/**
* Returns the log writer being used by this configuration to log