aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2019-06-17 23:28:52 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-06-18 02:22:21 +0200
commit7607465006aa226684a903b4b147982fe220428d (patch)
tree85b6062a7e060647b41c2a76e702703fef158a4c
parente3bcfe56c7bfab514625a65a6e7ae0d101fd698e (diff)
downloadjgit-7607465006aa226684a903b4b147982fe220428d.tar.gz
jgit-7607465006aa226684a903b4b147982fe220428d.zip
[Java 11] Remove dependency on javax.xml.bind package
Replace javax.xml.bind.DatatypeConverter, that is not available any more in Java 11 and later with Hex utility from non optional Bouncy Castle library. Bug: 540790 Change-Id: I9903c00ecc1a434e9795b8ba9267f02628fdc0e9 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
-rw-r--r--BUILD7
-rw-r--r--org.eclipse.jgit/BUILD4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java7
3 files changed, 3 insertions, 15 deletions
diff --git a/BUILD b/BUILD
index 5fea669f73..be6dd767d5 100644
--- a/BUILD
+++ b/BUILD
@@ -1,12 +1,5 @@
package(default_visibility = ["//visibility:public"])
-config_setting(
- name = "jdk9",
- values = {
- "java_toolchain": "@bazel_tools//tools/jdk:toolchain_jdk9",
- },
-)
-
genrule(
name = "all",
testonly = 1,
diff --git a/org.eclipse.jgit/BUILD b/org.eclipse.jgit/BUILD
index b67bfac5b6..814ecec9b8 100644
--- a/org.eclipse.jgit/BUILD
+++ b/org.eclipse.jgit/BUILD
@@ -14,10 +14,6 @@ RESOURCES = glob(["resources/**"])
java_library(
name = "jgit",
srcs = SRCS,
- javacopts = select({
- "//:jdk9": ["--add-modules=java.xml.bind"],
- "//conditions:default": [],
- }),
resource_strip_prefix = "org.eclipse.jgit/resources",
resources = RESOURCES,
deps = [
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
index b4248ee3fc..7a973aff34 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
@@ -66,8 +66,8 @@ import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import javax.crypto.spec.SecretKeySpec;
-import javax.xml.bind.DatatypeConverter;
+import org.bouncycastle.util.encoders.Hex;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.util.Base64;
@@ -301,7 +301,7 @@ abstract class WalkEncryption {
String DEFAULT_KEY_ALGO = JetS3tV2.ALGORITHM;
String DEFAULT_KEY_SIZE = Integer.toString(JetS3tV2.KEY_SIZE);
String DEFAULT_KEY_ITER = Integer.toString(JetS3tV2.ITERATIONS);
- String DEFAULT_KEY_SALT = DatatypeConverter.printHexBinary(JetS3tV2.SALT);
+ String DEFAULT_KEY_SALT = Hex.toHexString(JetS3tV2.SALT);
String EMPTY = ""; //$NON-NLS-1$
@@ -377,8 +377,7 @@ abstract class WalkEncryption {
final byte[] salt;
try {
- salt = DatatypeConverter
- .parseHexBinary(keySalt.replaceAll(REGEX_WS, EMPTY));
+ salt = Hex.decode(keySalt.replaceAll(REGEX_WS, EMPTY));
} catch (Exception e) {
throw securityError(X_KEY_SALT + EMPTY + keySalt);
}