I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 55260874 authored by zzz's avatar zzz
Browse files

* CPUID: If the 64 bit extract worked but the load failed, try 32 bit

parent ab17bd31
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
......@@ -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 = "";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment