Bug 1241202 - Improvement for native library loading
Summary: Improvement for native library loading
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: jss
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Christina Fu
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-08 17:44 UTC by Endi Sukma Dewata
Modified: 2016-12-20 14:15 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-20 14:15:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Endi Sukma Dewata 2015-07-08 17:44:24 UTC
The CryptoManager.loadNativeLibraries() can be replaced with the following static initialization block:

  static {
       System.out.println("CryptoManager: loading jss library:");
       if (new File("/usr/lib64/jss/libjss4.so").exists()) {
           System.out.println("CryptoManager: attempting load: /usr/lib64/jss/libjss4.so");
           System.load("/usr/lib64/jss/libjss4.so");

       } else if (new File("/usr/lib/jss/libjss4.so").exists()) {
           System.out.println("CryptoManager: attempting load: /usr/lib/jss/libjss4.so");
           System.load("/usr/lib/jss/libjss4.so");

       } else {
           System.out.println("CryptoManager: attempting loadLibrary: jss4");
           System.loadLibrary("jss4");
       }

       System.out.println("CryptoManager: jss library loaded");
   }

The above code provide some benefits over the existing code:

* In the above code the native library will be loaded once while the class is loaded, so any loading problem will be known immediately. The static block is thread safe and there is no need to maintain a variable to check if the library is already loaded.

* The above code does not catch the UnsatisfiedLinkError, so any error will break the execution and the stack trace will appear in the standard output/error log. The existing code catches the error, provides a minimal information, and does not break the execution, so the problem may not be immediately known.

* The above code checks if the native library is available before loading it, so it will only load it once for the appropriate platform. The existing code attempts to load the native library for all possible platforms without checking if the file exists, so it could not distinguish between non-existent file (which is a valid behavior) and actual loading error (which is a bug in the code).

Comment 1 Jan Kurik 2015-07-15 13:20:09 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 2 Fedora End Of Life 2016-11-24 12:10:51 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2016-12-20 14:15:18 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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