forked from I2P_Developers/i2p.i2p
Utils: Java 9 yakkety workarounds
This commit is contained in:
@ -330,15 +330,34 @@ public class DeallocationHelper {
|
||||
// drops the "-internal" suffix from the major version number for
|
||||
// an early access build (Ubuntu)
|
||||
javaVersionElements[0] = javaVersionElements[0].substring(0, indexOfEarlyAccessSuffix);
|
||||
} else {
|
||||
indexOfEarlyAccessSuffix = javaVersionElements[0].lastIndexOf("-Ubuntu");
|
||||
if (indexOfEarlyAccessSuffix != -1) {
|
||||
// drops the "-Ubuntu suffix from the major version number for
|
||||
// an early access build (Ubuntu)
|
||||
javaVersionElements[0] = javaVersionElements[0].substring(0, indexOfEarlyAccessSuffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
final int major, minor;
|
||||
if (javaVersionElements.length >= 2) {
|
||||
major = Integer.parseInt(javaVersionElements[0]);
|
||||
minor = Integer.parseInt(javaVersionElements[1]);
|
||||
int min;
|
||||
try {
|
||||
min = Integer.parseInt(javaVersionElements[1]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
min = 7;
|
||||
}
|
||||
minor = min;
|
||||
} else {
|
||||
major = 1;
|
||||
minor = Integer.parseInt(javaVersionElements[0]);
|
||||
int min;
|
||||
try {
|
||||
min = Integer.parseInt(javaVersionElements[0]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
min = 7;
|
||||
}
|
||||
minor = min;
|
||||
}
|
||||
final String directBufferAttachmentFieldName;
|
||||
if (minor == 1 && major <= 6)
|
||||
|
@ -5,7 +5,8 @@ import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
/**
|
||||
* Moved from CryptixAESEngine and net.i2p.router.tasks.CryptoChecker
|
||||
* Moved from CryptixAESEngine and net.i2p.router.tasks.CryptoChecker.
|
||||
* This class does not do any logging. See CryptoChecker for the logging.
|
||||
*
|
||||
* @since 0.9.23
|
||||
*/
|
||||
@ -28,6 +29,33 @@ public class CryptoCheck {
|
||||
unlimited = true;
|
||||
} catch (GeneralSecurityException gse) {
|
||||
}
|
||||
} catch (ExceptionInInitializerError eiie) {
|
||||
// Java 9 b134 bug
|
||||
// > java -jar build/i2p.jar cryptocheck
|
||||
// Exception in thread "main" java.lang.ExceptionInInitializerError
|
||||
// at javax.crypto.JceSecurityManager.<clinit>(java.base@9-Ubuntu/JceSecurityManager.java:65)
|
||||
// at javax.crypto.Cipher.getConfiguredPermission(java.base@9-Ubuntu/Cipher.java:2595)
|
||||
// at javax.crypto.Cipher.getMaxAllowedKeyLength(java.base@9-Ubuntu/Cipher.java:2619)
|
||||
// at net.i2p.crypto.CryptoCheck.<clinit>(CryptoCheck.java:19)
|
||||
// at java.lang.Class.forName0(java.base@9-Ubuntu/Native Method)
|
||||
// at java.lang.Class.forName(java.base@9-Ubuntu/Class.java:374)
|
||||
// at net.i2p.util.CommandLine.exec(CommandLine.java:66)
|
||||
// at net.i2p.util.CommandLine.main(CommandLine.java:51)
|
||||
// Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
|
||||
// at javax.crypto.JceSecurity.<clinit>(java.base@9-Ubuntu/JceSecurity.java:91)
|
||||
// ... 8 more
|
||||
// Caused by: java.lang.NullPointerException
|
||||
// at sun.nio.fs.UnixPath.normalizeAndCheck(java.base@9-Ubuntu/UnixPath.java:75)
|
||||
// at sun.nio.fs.UnixPath.<init>(java.base@9-Ubuntu/UnixPath.java:69)
|
||||
// at sun.nio.fs.UnixFileSystem.getPath(java.base@9-Ubuntu/UnixFileSystem.java:280)
|
||||
// at java.nio.file.Paths.get(java.base@9-Ubuntu/Paths.java:84)
|
||||
// at javax.crypto.JceSecurity.setupJurisdictionPolicies(java.base@9-Ubuntu/JceSecurity.java:254)
|
||||
// at javax.crypto.JceSecurity.access$000(java.base@9-Ubuntu/JceSecurity.java:49)
|
||||
// at javax.crypto.JceSecurity$1.run(java.base@9-Ubuntu/JceSecurity.java:82)
|
||||
// at javax.crypto.JceSecurity$1.run(java.base@9-Ubuntu/JceSecurity.java:79)
|
||||
// at java.security.AccessController.doPrivileged(java.base@9-Ubuntu/Native Method)
|
||||
// at javax.crypto.JceSecurity.<clinit>(java.base@9-Ubuntu/JceSecurity.java:78)
|
||||
// ... 8 more
|
||||
}
|
||||
_isUnlimited = unlimited;
|
||||
}
|
||||
|
@ -57,8 +57,13 @@ public class CryptoChecker {
|
||||
if (log != null)
|
||||
log.logAlways(Log.WARN, s);
|
||||
System.out.println(s);
|
||||
} else if (SystemVersion.isJava9()) {
|
||||
s = "Java 9 support is beta, check for Java updates";
|
||||
if (log != null)
|
||||
log.logAlways(Log.WARN, s);
|
||||
System.out.println("Warning: " + s);
|
||||
}
|
||||
if (!CryptoCheck.isUnlimited()) {
|
||||
if (!CryptoCheck.isUnlimited() && !SystemVersion.isJava9()) {
|
||||
s = "Please consider installing the Java Cryptography Unlimited Strength Jurisdiction Policy Files from ";
|
||||
//if (SystemVersion.isJava8())
|
||||
// s += JRE8;
|
||||
|
Reference in New Issue
Block a user