Hello,
I’m trying to store some data in the global secure storage using java. I’ve been following the instructions on https://docs.legato.io/16_07/javaBuild.html#javaBuild_apis and have in my adef file:
bindings:
{
helloJava.BluWaterInitComponent.secStoreGlobal -> secStore.secStoreGlobal
}
And cdef file:
api: {
secStoreGlobal = le_secStore.api
}
This causes the interface and the implementing client class to be generated. I then, in the main class that inherits component, puts
public void setsecStoreGlobal(secStoreGlobal sec) {
this.sec = sec;
}
Finally som test code in componentInit:
System.out.println(“Starting”);
BigInteger data = new BigInteger[2];
data[0] = BigInteger.valueOf(67L);
data[1] = BigInteger.valueOf(48L);
System.out.println(sec.toString()); //Crash here, sec is null
sec.Write(“Message”, data);
This causes a null pointer exception since sec is null. I cannot instantiate the secStoreGlobal with the generated secStoreGlobalClient since the class can’t find it and in the generated secStoreGlobalClient the package section there is actually an error that the package does not match the expected package. Which is strange since it’s an autogenerated class. If I try to import the secStoreGlobalClient class into the main class it can’t be found.
In the autogenerated secStoreGlobalClient class it looks like this:
package io.legato.api.implementation;
/**Gets error: The declared package “io.legato.api.implementation” does not match the expected package “”*/
Have I missed something when I’m setting up the java API generation? What is causing the autogenerated class to get an error like this?