Skip to content

Commit 3387d3e

Browse files
committed
fix public static native methods: ensure native lib is loaded first
1 parent 392cf18 commit 3387d3e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

objectbox-java/src/main/java/io/objectbox/BoxStore.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
@ThreadSafe
6060
public class BoxStore implements Closeable {
6161

62-
private static final String VERSION = "1.4.4-2018-03-08";
62+
private static final String VERSION = "1.4.5-2018-03-11";
6363
private static BoxStore defaultStore;
6464

6565
private static final Set<String> openFiles = new HashSet<>();
@@ -97,7 +97,12 @@ public static synchronized boolean clearDefaultStore() {
9797
return existedBefore;
9898
}
9999

100-
public static native String getVersionNative();
100+
static native String nativeGetVersion();
101+
102+
public static String getVersionNative() {
103+
NativeLibraryLoader.ensureLoaded();
104+
return nativeGetVersion();
105+
}
101106

102107
/**
103108
* Diagnostics: If this method crashes on a device, please send us the logcat output.
@@ -132,7 +137,12 @@ static native void nativeRegisterCustomType(long store, int entityId, int proper
132137

133138
static native String nativeStartObjectBrowser(long store, @Nullable String urlPath, int port);
134139

135-
public static native boolean isObjectBrowserAvailable();
140+
static native boolean nativeIsObjectBrowserAvailable();
141+
142+
public static boolean isObjectBrowserAvailable() {
143+
NativeLibraryLoader.ensureLoaded();
144+
return nativeIsObjectBrowserAvailable();
145+
}
136146

137147
public static String getVersion() {
138148
return VERSION;

0 commit comments

Comments
 (0)