fix: Properly handle Java exceptions without error messages; fix loading of comet native library from java.library.path #982
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
This is a minor, non-user-aware fix so I've not created a GtHub issue. A detailed explanation is provided in the next section.
Rationale for this change
I had this small patch in my local workspace for a while, I think it is useful for other comet developers as well. The changes are as follows:
System.loadLibrary
states that "The libname argument must not contain any platform specific prefix, file extension or path", so the library name should becomet
instead oflibcomet.so
orlibcomet.dylib
. This fix makes it easier to load the newly built comet library in thenative/target
directory when running Java tests.It does not point to the source of the NPE, which makes troubleshooting difficult. This patch checks if the error message retrieved by the
.getMessage
JNI call is null and handles it specially. The error message becomes:What changes are included in this PR?
This PR includes fixes for the minor problems mentioned above.
How are these changes tested?
Add a unit test for problem 2.