diff --git a/apps/jrobin/java/src/engine/misc/DeallocationHelper.java b/apps/jrobin/java/src/engine/misc/DeallocationHelper.java index 3bc2205e0..f37d83f1e 100644 --- a/apps/jrobin/java/src/engine/misc/DeallocationHelper.java +++ b/apps/jrobin/java/src/engine/misc/DeallocationHelper.java @@ -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) diff --git a/core/java/src/net/i2p/crypto/CryptoCheck.java b/core/java/src/net/i2p/crypto/CryptoCheck.java index 31eac62dc..01a6c9040 100644 --- a/core/java/src/net/i2p/crypto/CryptoCheck.java +++ b/core/java/src/net/i2p/crypto/CryptoCheck.java @@ -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.(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.(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.(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.(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.(java.base@9-Ubuntu/JceSecurity.java:78) + // ... 8 more } _isUnlimited = unlimited; } diff --git a/router/java/src/net/i2p/router/tasks/CryptoChecker.java b/router/java/src/net/i2p/router/tasks/CryptoChecker.java index 49bd84da5..4edcbb9ca 100644 --- a/router/java/src/net/i2p/router/tasks/CryptoChecker.java +++ b/router/java/src/net/i2p/router/tasks/CryptoChecker.java @@ -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;