File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import com .sun .jna .Pointer ;
12import com .sun .jna .Structure ;
23import com .sun .jna .Structure .FieldOrder ;
34
45@ FieldOrder ({"code" , "message" })
56public class ExternError extends Structure {
67 public int code ;
7- public String message ;
8+ public Pointer message ;
89
910 public void RaiseError () throws DidException {
1011 if (this .code == 0 )
1112 return ;
12- throw new DidException (this .code , this .message );
13+ // Create the string, then dump the backing store.
14+ var messageString = this .message .getString (0 , "UTF-8" );
15+ OkapiNative .getNativeLibrary ().okapi_string_free (this .message );
16+ throw new DidException (this .code , messageString );
1317 }
1418}
Original file line number Diff line number Diff line change 1- import com .google .protobuf .* ;
1+ import com .google .protobuf .GeneratedMessageV3 ;
22import com .sun .jna .Native ;
33
44import java .nio .file .Paths ;
@@ -37,7 +37,7 @@ public interface IOkapiC extends com.sun.jna.Library {
3737
3838 void okapi_bytebuffer_free (OkapiByteBuffer .ByValue v );
3939
40- void okapi_string_free (com .sun .jna .ptr . ByteByReference s );
40+ void okapi_string_free (com .sun .jna .Pointer s );
4141 }
4242
4343 private static IOkapiC nativeLibrary = null ;
You can’t perform that action at this time.
0 commit comments