Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
Fixed some warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jul 13, 2012
1 parent 3679a02 commit b3bcf36
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .fbprefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#FindBugs User Preferences
#Fri Feb 24 13:50:19 CET 2012
#Fri Jul 13 08:53:48 CEST 2012
cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud
detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
detectorAtomicityProblem=AtomicityProblem|true
Expand Down Expand Up @@ -131,6 +131,6 @@ detectorXMLFactoryBypass=XMLFactoryBypass|true
detector_threshold=3
effort=max
excludefilter0=../analysis-config/etc/findbugs-exclusion-filter.xml|true
filter_settings=Low|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|20
filter_settings_neg=NOISE,I18N|
filter_settings=Low|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|20
filter_settings_neg=NOISE|
run_at_full_build=true
17 changes: 15 additions & 2 deletions src/main/java/hudson/plugins/analysis/util/StringPluginLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;

/**
* A logger that prints to a string buffer. The logged message are available
* using the {@link #toString()} method.
*
* @author Ulli Hafner
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings("DM")
public class StringPluginLogger extends PluginLogger {
private static final String ENCODING = "UTF-8";
private final ByteArrayOutputStream stream = new ByteArrayOutputStream();

/**
Expand All @@ -21,12 +24,22 @@ public class StringPluginLogger extends PluginLogger {
public StringPluginLogger(final String pluginName) {
super(pluginName);

setLogger(new PrintStream(stream));
try {
setLogger(new PrintStream(stream, true, ENCODING));
}
catch (UnsupportedEncodingException exception) {
setLogger(new PrintStream(stream));
}
}

@Override
public String toString() {
return stream.toString();
try {
return stream.toString(ENCODING);
}
catch (UnsupportedEncodingException exception) {
return stream.toString();
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
* @author Kohsuke Kawaguchi
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings("")
@SuppressWarnings({"PMD", "all"})
//CHECKSTYLE:OFF
public class TreeStringBuilder {
Expand Down Expand Up @@ -125,15 +126,19 @@ private void dedup(final Map<String, char[]> table) {
* Interns a string.
*/
public TreeString intern(final String s) {
if (s==null) return null;
if (s==null) {
return null;
}
return root.intern(s).node;
}

/**
* Interns a {@link TreeString} created elsewhere.
*/
public TreeString intern(final TreeString s) {
if (s==null) return null;
if (s==null) {
return null;
}
return root.intern(s.toString()).node;
}

Expand Down

0 comments on commit b3bcf36

Please sign in to comment.