2
0

Fix JNI native symbol names after refactor.

This commit is contained in:
Maarten Billemont
2020-04-14 20:07:21 -04:00
parent 9a362f13a3
commit b79ed1ca0b
3 changed files with 16 additions and 16 deletions

View File

@@ -227,7 +227,8 @@ public interface MPAlgorithm {
private static final int AES_BLOCKSIZE = 128 /* bit */;
static {
Native.load( MPAlgorithm.class, "mpw" );
if (!Native.load( MPAlgorithm.class, "mpw" ))
Logger.get( MPAlgorithm.class ).err( "Native mpw library unavailable." );
}
protected final Logger logger = Logger.get( getClass() );

View File

@@ -74,9 +74,9 @@ public final class Native {
// Write the library resource to a temporary file.
libraryFile = File.createTempFile( libraryName, libraryExtension );
libraryFile.deleteOnExit();
FileOutputStream libraryFileStream = new FileOutputStream( libraryFile );
try {
libraryFile.deleteOnExit();
ByteStreams.copy( libraryStream, libraryFileStream );
}
finally {
@@ -91,9 +91,8 @@ public final class Native {
catch (@SuppressWarnings("ErrorNotRethrown") final IOException | UnsatisfiedLinkError e) {
logger.wrn( e, "Couldn't load library: %s", libraryResource );
if (libraryFile != null)
if (libraryFile.exists() && !libraryFile.delete())
logger.wrn( "Couldn't clean up library file: %s", libraryFile );
if (libraryFile != null && libraryFile.exists() && !libraryFile.delete())
logger.wrn( "Couldn't clean up library file: %s", libraryFile );
libraryFile = null;
}
}