mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 13:19:52 +01:00
upgrade to jnotify 0.94 (patched) for 64-bit support, and improve error reporting in tests
- add a UnixRemovableDriveMonitor.checkEnabled to pre-emptively check if it's loaded - os.arch is always x86,x86_64 on windows, i386,amd64 on linux - source: http://www.java-gaming.org/index.php/topic,14110 - we'll deal with freebsd support when we come to it, jnotify doesn't even do this atm
This commit is contained in:
Binary file not shown.
BIN
briar-desktop/libs/jnotify-0.94.jar
Normal file
BIN
briar-desktop/libs/jnotify-0.94.jar
Normal file
Binary file not shown.
BIN
briar-desktop/libs/jnotify-x86.dll
Normal file
BIN
briar-desktop/libs/jnotify-x86.dll
Normal file
Binary file not shown.
BIN
briar-desktop/libs/jnotify-x86_64.dll
Normal file
BIN
briar-desktop/libs/jnotify-x86_64.dll
Normal file
Binary file not shown.
BIN
briar-desktop/libs/libjnotify-amd64.so
Normal file
BIN
briar-desktop/libs/libjnotify-amd64.so
Normal file
Binary file not shown.
BIN
briar-desktop/libs/libjnotify-i386.so
Normal file
BIN
briar-desktop/libs/libjnotify-i386.so
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,27 @@ JNotifyListener {
|
|||||||
|
|
||||||
protected abstract String[] getPathsToWatch();
|
protected abstract String[] getPathsToWatch();
|
||||||
|
|
||||||
|
final private static Throwable loadError = tryLoad();
|
||||||
|
|
||||||
|
private static Throwable tryLoad() {
|
||||||
|
try {
|
||||||
|
Class.forName("net.contentobjects.jnotify.JNotify");
|
||||||
|
return null;
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
return e;
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkEnabled() throws IOException {
|
||||||
|
if (loadError != null) {
|
||||||
|
throw new IOException("JNotify not loaded", loadError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void start(Callback callback) throws IOException {
|
public void start(Callback callback) throws IOException {
|
||||||
|
checkEnabled();
|
||||||
List<Integer> watches = new ArrayList<Integer>();
|
List<Integer> watches = new ArrayList<Integer>();
|
||||||
int mask = JNotify.FILE_CREATED;
|
int mask = JNotify.FILE_CREATED;
|
||||||
for(String path : getPathsToWatch()) {
|
for(String path : getPathsToWatch()) {
|
||||||
@@ -36,6 +56,7 @@ JNotifyListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stop() throws IOException {
|
public void stop() throws IOException {
|
||||||
|
checkEnabled();
|
||||||
List<Integer> watches;
|
List<Integer> watches;
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
assert started;
|
assert started;
|
||||||
|
|||||||
@@ -76,10 +76,11 @@
|
|||||||
</javac>
|
</javac>
|
||||||
</target>
|
</target>
|
||||||
<target name='test' depends='compile'>
|
<target name='test' depends='compile'>
|
||||||
<junit printsummary='on' fork='yes' forkmode='once'>
|
<junit printsummary='on' fork='yes' forkmode='once' haltonfailure='yes' showoutput='true'>
|
||||||
<assertions>
|
<assertions>
|
||||||
<enable/>
|
<enable/>
|
||||||
</assertions>
|
</assertions>
|
||||||
|
<formatter type="plain" usefile="false"/>
|
||||||
<classpath>
|
<classpath>
|
||||||
<fileset refid='test-jars'/>
|
<fileset refid='test-jars'/>
|
||||||
<fileset refid='desktop-jars'/>
|
<fileset refid='desktop-jars'/>
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
<path refid='core-classes'/>
|
<path refid='core-classes'/>
|
||||||
<path refid='api-classes'/>
|
<path refid='api-classes'/>
|
||||||
</classpath>
|
</classpath>
|
||||||
<jvmarg value='-Djava.library.path=../briar-desktop/libs'/>
|
<sysproperty key='java.library.path' value='../briar-desktop/libs'/>
|
||||||
<test name='org.briarproject.LockFairnessTest'/>
|
<test name='org.briarproject.LockFairnessTest'/>
|
||||||
<test name='org.briarproject.ProtocolIntegrationTest'/>
|
<test name='org.briarproject.ProtocolIntegrationTest'/>
|
||||||
<test name='org.briarproject.crypto.FortunaGeneratorTest'/>
|
<test name='org.briarproject.crypto.FortunaGeneratorTest'/>
|
||||||
@@ -153,7 +154,7 @@
|
|||||||
<path refid='core-classes'/>
|
<path refid='core-classes'/>
|
||||||
<path refid='api-classes'/>
|
<path refid='api-classes'/>
|
||||||
</classpath>
|
</classpath>
|
||||||
<jvmarg value='-Djava.library.path=../briar-desktop/libs'/>
|
<sysproperty key='java.library.path' value='../briar-desktop/libs'/>
|
||||||
<test name='org.briarproject.db.H2DatabaseTest'/>
|
<test name='org.briarproject.db.H2DatabaseTest'/>
|
||||||
</junit>
|
</junit>
|
||||||
</target>
|
</target>
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase {
|
|||||||
TestUtils.deleteTestDirectory(testDir);
|
TestUtils.deleteTestDirectory(testDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RemovableDriveMonitor createMonitor(final File dir) {
|
private RemovableDriveMonitor createMonitor(final File dir) throws IOException {
|
||||||
|
UnixRemovableDriveMonitor.checkEnabled();
|
||||||
return new UnixRemovableDriveMonitor() {
|
return new UnixRemovableDriveMonitor() {
|
||||||
@Override
|
@Override
|
||||||
protected String[] getPathsToWatch() {
|
protected String[] getPathsToWatch() {
|
||||||
|
|||||||
113
jnotify-0.94.patch
Normal file
113
jnotify-0.94.patch
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
briar-desktop/libs/jnotify-0.94.jar is built via:
|
||||||
|
$ wget "http://downloads.sourceforge.net/project/jnotify/jnotify/jnotify-0.94/jnotify-lib-0.94.zip?r=&ts=$(date +%s)"
|
||||||
|
$ unzip -d jnotify-lib-0.94 jnotify-lib-0.94.zip && cd jnotify-lib-0.94
|
||||||
|
$ unzip -d src jnotify-0.94-src.zip
|
||||||
|
$ wget -O build.xml "http://jnotify.cvs.sourceforge.net/viewvc/jnotify/jnotify/build.xml?revision=1.7&pathrev=HEAD"
|
||||||
|
$ wget -O build.properties "http://jnotify.cvs.sourceforge.net/viewvc/jnotify/jnotify/build.properties?revision=1.13"
|
||||||
|
$ patch -lp1 < /path/to/this/patch
|
||||||
|
$ ant build_java # if this fails with invalid flag: -g:{lines,vars,source}, try removing the debug attributes from <javac>
|
||||||
|
|
||||||
|
diff -ru jnotify-0.94/net/contentobjects/jnotify/linux/JNotify_linux.java jnotify-0.94-briar/net/contentobjects/jnotify/linux/JNotify_linux.java
|
||||||
|
--- jnotify-0.94/net/contentobjects/jnotify/linux/JNotify_linux.java 2012-04-25 00:03:54.000000000 +0100
|
||||||
|
+++ jnotify-0.94-briar/net/contentobjects/jnotify/linux/JNotify_linux.java 2014-01-30 12:31:41.959082350 +0000
|
||||||
|
@@ -37,6 +37,7 @@
|
||||||
|
package net.contentobjects.jnotify.linux;
|
||||||
|
|
||||||
|
import net.contentobjects.jnotify.JNotifyException;
|
||||||
|
+import net.contentobjects.jnotify.Util;
|
||||||
|
|
||||||
|
public class JNotify_linux
|
||||||
|
{
|
||||||
|
@@ -45,7 +46,7 @@
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
- System.loadLibrary("jnotify");
|
||||||
|
+ Util.loadNative();
|
||||||
|
int res = nativeInit();
|
||||||
|
if (res != 0)
|
||||||
|
{
|
||||||
|
diff -ru jnotify-0.94/net/contentobjects/jnotify/macosx/JNotify_macosx.java jnotify-0.94-briar/net/contentobjects/jnotify/macosx/JNotify_macosx.java
|
||||||
|
--- jnotify-0.94/net/contentobjects/jnotify/macosx/JNotify_macosx.java 2010-01-26 19:43:42.000000000 +0000
|
||||||
|
+++ jnotify-0.94-briar/net/contentobjects/jnotify/macosx/JNotify_macosx.java 2014-01-30 12:31:41.959082350 +0000
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
package net.contentobjects.jnotify.macosx;
|
||||||
|
|
||||||
|
import net.contentobjects.jnotify.JNotifyException;
|
||||||
|
+import net.contentobjects.jnotify.Util;
|
||||||
|
|
||||||
|
public class JNotify_macosx
|
||||||
|
{
|
||||||
|
@@ -10,7 +11,7 @@
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
- System.loadLibrary("jnotify"); //$NON-NLS-1$
|
||||||
|
+ Util.loadNative();
|
||||||
|
Thread thread = new Thread("FSEvent thread") //$NON-NLS-1$
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
diff -ru jnotify-0.94/net/contentobjects/jnotify/Util.java jnotify-0.94-briar/net/contentobjects/jnotify/Util.java
|
||||||
|
--- jnotify-0.94/net/contentobjects/jnotify/Util.java 2006-02-14 08:18:10.000000000 +0000
|
||||||
|
+++ jnotify-0.94-briar/net/contentobjects/jnotify/Util.java 2014-01-30 12:31:41.959082350 +0000
|
||||||
|
@@ -30,4 +30,26 @@
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ public static void loadNative() throws UnsatisfiedLinkError {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ System.loadLibrary("jnotify");
|
||||||
|
+ }
|
||||||
|
+ catch (UnsatisfiedLinkError e) {
|
||||||
|
+ System.loadLibrary("jnotify-" + System.getProperty("os.arch"));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ catch (UnsatisfiedLinkError e)
|
||||||
|
+ {
|
||||||
|
+ // add some extra debugging info
|
||||||
|
+ String msg = "Error loading library, os.arch=" + System.getProperty("os.arch") +
|
||||||
|
+ ", java.library.path=" + System.getProperty("java.library.path");
|
||||||
|
+ UnsatisfiedLinkError e2 = new UnsatisfiedLinkError(msg);
|
||||||
|
+ e2.initCause(e);
|
||||||
|
+ throw e2;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
diff -ru jnotify-0.94/net/contentobjects/jnotify/win32/JNotify_win32.java jnotify-0.94-briar/net/contentobjects/jnotify/win32/JNotify_win32.java
|
||||||
|
--- jnotify-0.94/net/contentobjects/jnotify/win32/JNotify_win32.java 2012-04-25 00:04:50.000000000 +0100
|
||||||
|
+++ jnotify-0.94-briar/net/contentobjects/jnotify/win32/JNotify_win32.java 2014-01-30 12:31:41.959082350 +0000
|
||||||
|
@@ -39,28 +39,13 @@
|
||||||
|
package net.contentobjects.jnotify.win32;
|
||||||
|
|
||||||
|
import net.contentobjects.jnotify.JNotifyException;
|
||||||
|
-
|
||||||
|
+import net.contentobjects.jnotify.Util;
|
||||||
|
|
||||||
|
public class JNotify_win32
|
||||||
|
{
|
||||||
|
static
|
||||||
|
{
|
||||||
|
- try
|
||||||
|
- {
|
||||||
|
- if (System.getProperty("os.arch").equals("amd64"))
|
||||||
|
- {
|
||||||
|
- System.loadLibrary("jnotify_64bit");
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- System.loadLibrary("jnotify");
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- catch (UnsatisfiedLinkError e)
|
||||||
|
- {
|
||||||
|
- System.err.println("Error loading library, java.library.path=" + System.getProperty("java.library.path"));
|
||||||
|
- throw e;
|
||||||
|
- }
|
||||||
|
+ Util.loadNative();
|
||||||
|
int res = nativeInit();
|
||||||
|
if (res != 0)
|
||||||
|
{
|
||||||
Reference in New Issue
Block a user