mirror of
https://github.com/signalapp/libsignal.git
synced 2026-05-08 16:13:04 +02:00
java: Special-case the arch-specific load to account for "x86_64"
0453438d added the capability to prefer arch-specific versions of
libsignal_jni, but it turns out that some Java implementations use
"x86_64" rather than the "amd64" we expected. Rather than doing
something clever and general, just handle this one special case. If
this happens again with "arm64" vs "aarch64", we can spend more time
on it then.
This commit is contained in:
@@ -68,7 +68,12 @@ public final class Native {
|
||||
* This method should only be called from a static initializer.
|
||||
*/
|
||||
static void loadLibrary(String name) throws IOException {
|
||||
for (String suffix : new String[]{ "_" + System.getProperty("os.arch"), "" }) {
|
||||
String arch = System.getProperty("os.arch");
|
||||
// Special-case: some Java implementations use "x86_64", but OpenJDK uses "amd64".
|
||||
if (arch == "x86_64") {
|
||||
arch = "amd64";
|
||||
}
|
||||
for (String suffix : new String[]{ "_" + arch, "" }) {
|
||||
final String libraryName = System.mapLibraryName(name + suffix);
|
||||
try (InputStream in = Native.class.getResourceAsStream("/" + libraryName)) {
|
||||
if (in != null) {
|
||||
|
||||
@@ -68,7 +68,12 @@ public final class Native {
|
||||
* This method should only be called from a static initializer.
|
||||
*/
|
||||
static void loadLibrary(String name) throws IOException {
|
||||
for (String suffix : new String[]{ "_" + System.getProperty("os.arch"), "" }) {
|
||||
String arch = System.getProperty("os.arch");
|
||||
// Special-case: some Java implementations use "x86_64", but OpenJDK uses "amd64".
|
||||
if (arch == "x86_64") {
|
||||
arch = "amd64";
|
||||
}
|
||||
for (String suffix : new String[]{ "_" + arch, "" }) {
|
||||
final String libraryName = System.mapLibraryName(name + suffix);
|
||||
try (InputStream in = Native.class.getResourceAsStream("/" + libraryName)) {
|
||||
if (in != null) {
|
||||
|
||||
Reference in New Issue
Block a user