Hello,
I am working on a Java application that use large application resources.
On the application side, I want to send the path of my resource through a native method. I use the API SNI.toCString() to send the path from the Java world to the native world like the following:
public static void main(String[] args) {
sendApplicationResource(SNI.toCString("/my_resource"));
}
public static native void sendApplicationResource(byte[] path);
I try to implement a Mock that can read the Application Resource. I made the following implementation of the native method in my mock:
public static void sendApplicationResource(byte[] path) {
// Refresh HIL instance
NativeInterface ni = HIL.getInstance();
ni.refreshContent(path);
// Get resource data
String filePath = SNI.toJavaString(path);
byte[] modelData = ni.getResourceContent(filePath);
}
This native method works well with small Application resources (e.g. 100KB) but when I want to use larger application resources (on my side more than 500KB), it throws the following error when I launch my application on the Simulator:
Exception in thread "main" @T:java.lang.UnsatisfiedLinkError@: HIL client execution exception:
com.is2t.hil.BrokenConnection
at com.is2t.hil.HILEngine.getResourceContent(y:136)
at com.example.Main.sendApplicationResource(Main.java:16)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.is2t.hil.A.E.A(y:2401)
at com.is2t.hil.F.run(y:1285)
at java.lang.Throwable.fillInStackTrace(Throwable.java:109)
at java.lang.Throwable.<init>(Throwable.java:43)
at java.lang.Error.<init>(Error.java:18)
at java.lang.LinkageError.<init>(LinkageError.java:18)
at java.lang.UnsatisfiedLinkError.<init>(UnsatisfiedLinkError.java:10)
at com.example.Main.main(Main.java:18)
at java.lang.MainThread.run(Thread.java:915)
at java.lang.Thread.runWrapper(Thread.java:388)
Am I doing something wrong when processing my resources?