diff options
Diffstat (limited to 'libjava/java/lang/VMCompiler.java')
-rw-r--r-- | libjava/java/lang/VMCompiler.java | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/libjava/java/lang/VMCompiler.java b/libjava/java/lang/VMCompiler.java index 3eb4491ecec..6961a31d905 100644 --- a/libjava/java/lang/VMCompiler.java +++ b/libjava/java/lang/VMCompiler.java @@ -79,6 +79,24 @@ final class VMCompiler private static Vector precompiledMapFiles; + // We create a single MD5 engine and then clone it whenever we want + // a new one. This is simpler than trying to find a new one each + // time, and it avoids potential deadlocks due to class loader + // oddities. + private static final MessageDigest md5Digest; + + static + { + try + { + md5Digest = MessageDigest.getInstance("MD5"); + } + catch (NoSuchAlgorithmException _) + { + md5Digest = null; + } + } + static { gcjJitCompiler = System.getProperty("gnu.gcj.jit.compiler"); @@ -123,6 +141,10 @@ final class VMCompiler catch (java.io.IOException _) { } + catch (java.nio.BufferUnderflowException _) + { + // Invalid map file. + } } } } @@ -142,7 +164,8 @@ final class VMCompiler { Class c = null; SharedLibHelper helper - = SharedLibHelper.findHelper (loader, fileName, domain.getCodeSource()); + = SharedLibHelper.findHelper (loader, fileName, domain.getCodeSource(), + domain, false); c = helper.findClass (className); if (c != null) { @@ -174,11 +197,18 @@ final class VMCompiler try { - MessageDigest md = MessageDigest.getInstance("MD5"); + MessageDigest md = (MessageDigest) md5Digest.clone(); digest = md.digest(data); } - catch (NoSuchAlgorithmException _) + catch (CloneNotSupportedException _) + { + // Can't happen. + return null; + } + catch (NullPointerException _) { + // If md5Digest==null -- but really this should never happen + // either, since the MD5 digest is in libgcj. return null; } |