Skip to content

Commit fd5bd35

Browse files
committed
Load correct OpenSSL libraries on Windows 64
With OpenSSL 1.1.1 we are getting different names for the DLL depending on 32/64-bit Windows. Need to account for this when loading the DLL's so that they are found. Also, stopped trying to load DLL's we no longer provide. Issue: 131
1 parent ecb5dc9 commit fd5bd35

File tree

1 file changed

+51
-15
lines changed

1 file changed

+51
-15
lines changed

javahl/src/main/java/org/tigris/subversion/svnclientadapter/javahl/JhlClientAdapterFactory.java

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,22 @@
3232
public class JhlClientAdapterFactory extends SVNClientAdapterFactory {
3333

3434
private static final String[] WINDOWSLIBS = new String[] {
35-
"msvcr100", "msvcp100", "zlib-1",
36-
"libapr-1", "libapriconv-1", "libeay32", "ssleay32",
37-
"libcrypto-1_1", "capi", "libssl-1_1", "libaprutil-1",
38-
"dbghelp", "libsasl", "libserf-1",
39-
// libraries as of 1.5
35+
"msvcr100", "msvcp100",
36+
"libapr-1", "libapriconv-1",
37+
"libcrypto-1_1", "capi", "libssl-1_1",
38+
"libaprutil-1",
39+
"libserf-1",
40+
"libsvn_subr-1", "libsvn_delta-1", "libsvn_diff-1", "libsvn_wc-1",
41+
"libsvn_fs_util-1", "libsvn_fs_fs-1", "libsvn_fs_x-1", "libsvn_fs-1",
42+
"libsvn_repos-1", "libsvn_ra-1", "libsvn_client-1"
43+
};
44+
45+
private static final String[] WINDOWSLIBS64 = new String[] {
46+
"msvcr100", "msvcp100",
47+
"libapr-1", "libapriconv-1",
48+
"libcrypto-1_1-x64", "capi", "libssl-1_1-x64",
49+
"libaprutil-1",
50+
"libserf-1",
4051
"libsvn_subr-1", "libsvn_delta-1", "libsvn_diff-1", "libsvn_wc-1",
4152
"libsvn_fs_util-1", "libsvn_fs_fs-1", "libsvn_fs_x-1", "libsvn_fs-1",
4253
"libsvn_repos-1", "libsvn_ra-1", "libsvn_client-1"
@@ -106,16 +117,27 @@ public static boolean isAvailable() {
106117
// because of a problem in one of these libraries the proper behavior
107118
// will still occur -- meaning JavaHL adapter is disabled.
108119
if(isOsWindows()) {
109-
110-
for (int i = 0; i < WINDOWSLIBS.length; i++) {
111-
try {
112-
System.loadLibrary(WINDOWSLIBS[i]);
113-
} catch (Exception e) {
114-
javaHLErrors.append(e.getMessage()).append("\n");
115-
} catch (UnsatisfiedLinkError e) {
116-
javaHLErrors.append(e.getMessage()).append("\n");
117-
}
118-
}
120+
if (is32bit()) {
121+
for (int i = 0; i < WINDOWSLIBS.length; i++) {
122+
try {
123+
System.loadLibrary(WINDOWSLIBS[i]);
124+
} catch (Exception e) {
125+
javaHLErrors.append(e.getMessage()).append("\n");
126+
} catch (UnsatisfiedLinkError e) {
127+
javaHLErrors.append(e.getMessage()).append("\n");
128+
}
129+
}
130+
} else {
131+
for (int i = 0; i < WINDOWSLIBS64.length; i++) {
132+
try {
133+
System.loadLibrary(WINDOWSLIBS64[i]);
134+
} catch (Exception e) {
135+
javaHLErrors.append(e.getMessage()).append("\n");
136+
} catch (UnsatisfiedLinkError e) {
137+
javaHLErrors.append(e.getMessage()).append("\n");
138+
}
139+
}
140+
}
119141

120142
}
121143
//workaround to solve Subclipse ISSUE #83
@@ -215,6 +237,20 @@ public static boolean isOsWindows()
215237
return false;
216238
}
217239
}
240+
241+
/**
242+
* Answer whether running on 32-bit JVM
243+
* @return true when running on 32-bit JVM
244+
*/
245+
public static boolean is32bit()
246+
{
247+
try {
248+
return System.getProperty("os.arch").equalsIgnoreCase("x86");
249+
} catch (SecurityException ex) {
250+
// we are not allowed to look at this property
251+
return false;
252+
}
253+
}
218254

219255
/**
220256
* @return an error string describing problems during loading platform native libraries (if any)

0 commit comments

Comments
 (0)