diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2018-09-05 00:29:20 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-09-10 00:51:59 +0200 |
commit | f19625a1b8305c7762b57def535478f56975554f (patch) | |
tree | b2f77b097228b29ab1d960732f8e957c742b56c7 /org.eclipse.jgit.pgm.test/src | |
parent | f0517b5f384d36718ab5b9198c2fb9b2b3735c3c (diff) | |
download | jgit-f19625a1b8305c7762b57def535478f56975554f.tar.gz jgit-f19625a1b8305c7762b57def535478f56975554f.zip |
SpotBugs: don't rely on default encoding
Change-Id: Ic42f30c564270230fc629a917be85194d27d0338
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test/src')
-rw-r--r-- | org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java index 81875f11bc..9ad22ddf2e 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java @@ -42,11 +42,13 @@ */ package org.eclipse.jgit.pgm; +import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.assertNull; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; @@ -153,7 +155,8 @@ public class CLIGitCommand extends Main { @Override PrintWriter createErrorWriter() { - return new PrintWriter(result.err); + return new PrintWriter(new OutputStreamWriter( + result.err, UTF_8)); } @Override @@ -249,19 +252,19 @@ public class CLIGitCommand extends Main { } public String outString() { - return out.toString(); + return new String(out.toByteArray(), UTF_8); } public List<String> outLines() { - return IO.readLines(out.toString()); + return IO.readLines(outString()); } public String errString() { - return err.toString(); + return new String(err.toByteArray(), UTF_8); } public List<String> errLines() { - return IO.readLines(err.toString()); + return IO.readLines(errString()); } } |