aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2021-11-02 18:47:26 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2021-11-03 23:45:32 +0100
commit4184ff0953b2569799221d423e77fd2f6880f77d (patch)
treef59ad5c69e63406b389d1c6d68bc934a0f29ade8 /org.eclipse.jgit
parent30a8afd768419965441705f4e20f094275cc03ab (diff)
downloadjgit-4184ff0953b2569799221d423e77fd2f6880f77d.tar.gz
jgit-4184ff0953b2569799221d423e77fd2f6880f77d.zip
[releng] Make the bazel build use Java 11
Make the default toolchain use Java 11, and fix two errorprone findings introduced recently. Change-Id: Iff51206fe8bdf096cb7d88cb1a499002550766cd Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java9
2 files changed, 8 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
index aeb3c4563b..19961a13eb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
@@ -378,7 +378,7 @@ public class RawText extends Sequence {
* @since 6.0
*/
public static boolean isBinary(byte curr, byte prev) {
- return curr == '\0' || curr != '\n' && prev == '\r' || prev == '\0';
+ return curr == '\0' || (curr != '\n' && prev == '\r') || prev == '\0';
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java
index b77fb920ed..8ab13385e0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java
@@ -383,7 +383,10 @@ public final class StringUtils {
try {
return Math.multiplyExact(mul, number);
} catch (ArithmeticException e) {
- throw new NumberFormatException(e.getLocalizedMessage());
+ NumberFormatException nfe = new NumberFormatException(
+ e.getLocalizedMessage());
+ nfe.initCause(e);
+ throw nfe;
}
}
@@ -413,9 +416,11 @@ public final class StringUtils {
try {
return Math.toIntExact(parseLongWithSuffix(value, positiveOnly));
} catch (ArithmeticException e) {
- throw new NumberFormatException(
+ NumberFormatException nfe = new NumberFormatException(
MessageFormat.format(JGitText.get().valueExceedsRange,
value, Integer.class.getSimpleName()));
+ nfe.initCause(e);
+ throw nfe;
}
}