Bug 529919 - Wrap "System.load()" calls in JNI libraries within try-catch block
Summary: Wrap "System.load()" calls in JNI libraries within try-catch block
Keywords:
Status: CLOSED EOL
Alias: None
Product: Dogtag Certificate System
Classification: Retired
Component: Other
Version: 1.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: 1.3
Assignee: Matthew Harmsen
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-20 18:05 UTC by Matthew Harmsen
Modified: 2020-03-27 18:35 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-27 18:35:36 UTC
Embargoed:


Attachments (Terms of Use)
Diffs for osutil (12.04 KB, patch)
2009-10-28 15:56 UTC, Matthew Harmsen
no flags Details | Diff
Diffs for symkey (2.29 KB, patch)
2009-10-28 15:56 UTC, Matthew Harmsen
no flags Details | Diff
osutil.diffs (3.94 KB, patch)
2009-11-05 21:40 UTC, Matthew Harmsen
no flags Details | Diff
symkey.diffs (641 bytes, patch)
2009-11-05 21:40 UTC, Matthew Harmsen
no flags Details | Diff

Description Matthew Harmsen 2009-10-20 18:05:50 UTC
It was noticed that all JNI library calls to "System.loadLibrary()" generally ignore exceptions --- the code should be changed to catch and at least print out a message as to why the specified library cannot be loaded.

Comment 3 Matthew Harmsen 2009-10-28 15:56:26 UTC
Created attachment 366461 [details]
Diffs for osutil

Comment 4 Matthew Harmsen 2009-10-28 15:56:55 UTC
Created attachment 366462 [details]
Diffs for symkey

Comment 5 Andrew Wnuk 2009-10-28 16:31:57 UTC
attachment (id=366461)
attachment (id=366462)
+awnuk

Comment 6 Matthew Harmsen 2009-10-28 23:54:09 UTC
This fix also "hard-coded" directory paths (on Linux and Solaris) to satisfy the Fedora packaging requirements of using the "System.load()" instead of the "System.loadLibrary()" Java method calls.

# cd pki/base

# svn status | grep -v ^$ | grep -v ^P | grep -v ^X | grep -v ^?
M       osutil/src/com/netscape/osutil/LibC.java
M       osutil/src/com/netscape/osutil/Signal.java
M       osutil/src/com/netscape/osutil/OSUtil.java
M       osutil/src/com/netscape/osutil/NTEventLogger.java
M       osutil/src/com/netscape/osutil/ResourceLimit.java
M       osutil/src/com/netscape/osutil/UserID.java
M       symkey/src/com/netscape/symkey/SessionKey.java

# svn commit
Sending        base/osutil/src/com/netscape/osutil/LibC.java
Sending        base/osutil/src/com/netscape/osutil/NTEventLogger.java
Sending        base/osutil/src/com/netscape/osutil/OSUtil.java
Sending        base/osutil/src/com/netscape/osutil/ResourceLimit.java
Sending        base/osutil/src/com/netscape/osutil/Signal.java
Sending        base/osutil/src/com/netscape/osutil/UserID.java
Sending        base/symkey/src/com/netscape/symkey/SessionKey.java
Transmitting file data .......
Committed revision 806.

Comment 7 Matthew Harmsen 2009-11-05 21:40:16 UTC
Created attachment 367733 [details]
osutil.diffs

Remove Solaris condition.

Comment 8 Matthew Harmsen 2009-11-05 21:40:56 UTC
Created attachment 367734 [details]
symkey.diffs

Remove Solaris condition.

Comment 9 Andrew Wnuk 2009-11-05 21:49:08 UTC
attachment (id=367733) 
attachment (id=367734)
+awnuk

Comment 10 Matthew Harmsen 2009-11-05 22:03:22 UTC
# cd pki/base

# svn status | grep -v ^$ | grep -v ^P | grep -v ^X | grep -v ^?
M       osutil/src/com/netscape/osutil/LibC.java
M       osutil/src/com/netscape/osutil/Signal.java
M       osutil/src/com/netscape/osutil/OSUtil.java
M       osutil/src/com/netscape/osutil/NTEventLogger.java
M       osutil/src/com/netscape/osutil/ResourceLimit.java
M       osutil/src/com/netscape/osutil/UserID.java
M       symkey/src/com/netscape/symkey/SessionKey.java

# svn commit osutil symkey
Sending        osutil/src/com/netscape/osutil/LibC.java
Sending        osutil/src/com/netscape/osutil/NTEventLogger.java
Sending        osutil/src/com/netscape/osutil/OSUtil.java
Sending        osutil/src/com/netscape/osutil/ResourceLimit.java
Sending        osutil/src/com/netscape/osutil/Signal.java
Sending        osutil/src/com/netscape/osutil/UserID.java
Sending        symkey/src/com/netscape/symkey/SessionKey.java
Transmitting file data .......
Committed revision 811.

Comment 11 Kashyap Chamarthy 2011-05-06 10:40:28 UTC
Matt, can you please post info. on how QE can verify this?

Comment 12 Matthew Harmsen 2011-05-27 23:12:08 UTC
This code change was required by Fedora (although it may have to be changed yet again to comply with 'Bugzilla Bug #665576 - "build-classpath swt" fails on 64bit'), and required using the System.load() java call which requires a 'hard-coded path' to a library rather than the System.loadLibrary() java call which I believe may depend upon the search order defined by something like a LD_LIBRARY_PATH environment variable (which is set from within the confines of the server/program using these JNI libraries).

As this change was only on Fedora, and we know that this code works from numerous installations of both 32-bit and 64-bit Dogtag servers, the only thing which could/should be tested to verify it would be to attempt install/configure a 32-bit (i686) Dogtag server on a 64-bit (x86_64) host.


Note You need to log in before you can comment on or make changes to this bug.