Author: nextgens
Date: 2006-08-01 19:20:46 +0000 (Tue, 01 Aug 2006)
New Revision: 9841

Modified:
   trunk/freenet/src/net/i2p/util/NativeBigInteger.java
Log:
maybe that exception:

INFO   | jvm 1    | 2006/07/31 13:45:48 | ERROR: The resource 
net/i2p/util/libjbigi-linux-x86_64.so was not a valid
+library for this platform
INFO   | jvm 1    | 2006/07/31 13:45:48 | java.lang.UnsatisfiedLinkError: 
/tmp/jbigi48574lib.tmp:
+/tmp/jbigi48574lib.tmp: failed to map segment from shared object
: Operation not permitted
INFO   | jvm 1    | 2006/07/31 13:45:48 |       at 
java.lang.ClassLoader$NativeLibrary.load(Native Method)
INFO   | jvm 1    | 2006/07/31 13:45:48 |       at 
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
INFO   | jvm 1    | 2006/07/31 13:45:48 |       at 
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)
INFO   | jvm 1    | 2006/07/31 13:45:48 |       at 
java.lang.Runtime.load0(Runtime.java:769)
INFO   | jvm 1    | 2006/07/31 13:45:48 |       at 
java.lang.System.load(System.java:967)
INFO   | jvm 1    | 2006/07/31 13:45:48 |       at
+net.i2p.util.NativeBigInteger.loadFromResource(NativeBigInteger.java:517)
INFO   | jvm 1    | 2006/07/31 13:45:48 |       at 
net.i2p.util.NativeBigInteger.loadNative(NativeBigInteger.java:416)
INFO   | jvm 1    | 2006/07/31 13:45:48 |       at 
net.i2p.util.NativeBigInteger.<clinit>(NativeBigInteger.java:126)


Modified: trunk/freenet/src/net/i2p/util/NativeBigInteger.java
===================================================================
--- trunk/freenet/src/net/i2p/util/NativeBigInteger.java        2006-08-01 
18:43:42 UTC (rev 9840)
+++ trunk/freenet/src/net/i2p/util/NativeBigInteger.java        2006-08-01 
19:20:46 UTC (rev 9841)
@@ -517,11 +517,27 @@
             System.load(outFile.getAbsolutePath()); //System.load requires an 
absolute path to the lib
             return true;
         } catch (UnsatisfiedLinkError ule) {
-            if (_doLog) {
-                System.err.println("ERROR: The resource " + resourceName 
-                                   + " was not a valid library for this 
platform");
-                ule.printStackTrace();
-            }
+               try{
+                       System.err.println("We have detected a NOEXEC on your 
temporary directory, trying in current one insteed.");
+                       InputStream libStream = resource.openStream();
+                       outFile = new File("jbigi-lib.tmp");
+                       FileOutputStream fos = new FileOutputStream(outFile);
+                byte buf[] = new byte[4096*1024];
+                while (true) {
+                    int read = libStream.read(buf);
+                    if (read < 0) break;
+                    fos.write(buf, 0, read);
+                }
+                fos.close();
+                System.load(outFile.getAbsolutePath());
+                return true;
+               } catch (Exception aule) {
+                       if (_doLog) {
+                               System.err.println("ERROR: The resource " + 
resourceName 
+                                               + " was not a valid library for 
this platform");
+                               ule.printStackTrace();
+                       }
+               }
             return false;
         } catch (IOException ioe) {
             if (_doLog) {


Reply via email to