diff --git a/core/java/src/freenet/support/CPUInformation/CPUID.java b/core/java/src/freenet/support/CPUInformation/CPUID.java index 3d9c8fe240629f32fc7cece010d29809e5bef4ba..30d94a28e2ae9276e95491447d9abc41ef36d207 100644 --- a/core/java/src/freenet/support/CPUInformation/CPUID.java +++ b/core/java/src/freenet/support/CPUInformation/CPUID.java @@ -612,24 +612,37 @@ public class CPUID { * */ private static final boolean loadFromResource() { - URL resource = null; // try 64 bit first, if getResourceName64() returns non-null String resourceName = getResourceName64(); - if (resourceName != null) - resource = CPUID.class.getClassLoader().getResource(resourceName); - - if (resource == null) { - // now try 32 bit - resourceName = getResourceName(); - resource = CPUID.class.getClassLoader().getResource(resourceName); + if (resourceName != null) { + boolean success = extractLoadAndCopy(resourceName); + if (success) + return true; } + + // now try 32 bit + resourceName = getResourceName(); + boolean success = extractLoadAndCopy(resourceName); + if (success) + return true; - if (resource == null) { - if (_doLog) - System.err.println("WARNING: Resource name [" + resourceName + "] was not found"); - return false; - } + if (_doLog) + System.err.println("WARNING: Resource name [" + resourceName + "] was not found"); + return false; + } + /** + * Extract a single resource, copy it to a temp location in the file system, + * and attempt to load it. If the load succeeds, copy it to the installation + * directory. Return value reflects only load success - copy will fail silently. + * + * @return true if it was loaded successfully, else false. + * @since 0.8.7 + */ + private static final boolean extractLoadAndCopy(String resourceName) { + URL resource = CPUID.class.getClassLoader().getResource(resourceName); + if (resource == null) + return false; File outFile = null; FileOutputStream fos = null; String filename = libPrefix + "jcpuid" + libSuffix; @@ -652,12 +665,16 @@ public class CPUID { + " was not a valid library for this platform"); ule.printStackTrace(); } + if (outFile != null) + outFile.delete(); return false; } catch (IOException ioe) { if (_doLog) { System.err.println("ERROR: Problem writing out the temporary native library data"); ioe.printStackTrace(); } + if (outFile != null) + outFile.delete(); return false; } finally { if (fos != null) { diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index c10128fe6223a59f4fa2320e38c3309487438a87..fecba78d6973d87e9930d631de787e05fec2a510 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 6; + public final static long BUILD = 7; /** for example "-test" */ public final static String EXTRA = "";