summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2017-05-13 18:56:03 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2017-05-15 10:29:47 +0200
commitf1dd61f646e1a217aeed58e2057b4a47c42077e9 (patch)
tree7b44ffdb2333b45913455dfb79c64d01b3d039b3
parent0aa1a19cab99dc2525389c0680c661e004ded4d4 (diff)
downloadjgit-f1dd61f646e1a217aeed58e2057b4a47c42077e9.tar.gz
jgit-f1dd61f646e1a217aeed58e2057b4a47c42077e9.zip
[findBugs] Use UTF-8 to read git-rebase-todo file
Change-Id: I7c6f71e13ef106678157eae1aa3f9d39712e577b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
index 1047a6df99..c4923a359e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
@@ -43,6 +43,8 @@
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@@ -177,8 +179,8 @@ public class RebaseTodoFile {
while (tokenCount < 3 && nextSpace < lineEnd) {
switch (tokenCount) {
case 0:
- String actionToken = new String(buf, tokenBegin, nextSpace
- - tokenBegin - 1);
+ String actionToken = new String(buf, tokenBegin,
+ nextSpace - tokenBegin - 1, UTF_8);
tokenBegin = nextSpace;
action = RebaseTodoLine.Action.parse(actionToken);
if (action == null)
@@ -186,14 +188,14 @@ public class RebaseTodoFile {
break;
case 1:
nextSpace = RawParseUtils.next(buf, tokenBegin, ' ');
- String commitToken = new String(buf, tokenBegin, nextSpace
- - tokenBegin - 1);
+ String commitToken = new String(buf, tokenBegin,
+ nextSpace - tokenBegin - 1, UTF_8);
tokenBegin = nextSpace;
commit = AbbreviatedObjectId.fromString(commitToken);
break;
case 2:
- return new RebaseTodoLine(action, commit, RawParseUtils.decode(
- buf, tokenBegin, 1 + lineEnd));
+ return new RebaseTodoLine(action, commit,
+ RawParseUtils.decode(buf, tokenBegin, 1 + lineEnd));
}
tokenCount++;
}