You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not a user of the Java bindings, so take this with a grain of salt.
From what I see this is not a bug. Since the Key class wraps JNA pointers you can not compare the Key object to null. You have to call get() (which is your workaround) or even simply use the existing isNull() function.
if (!set.lookup("user:/unsetkey").isNull()) {
thrownewAssertionError();
}
That being said, improvements to the Java bindings/API are welcome and a consistent use of optionals could make sense. 👍
At least the current behavior contradicts the documentation of the function: @return Key if search successful, null otherwise - Therefore i would consider this a bug.
Apart from that i would consider returning a Key object which has to be checked for referencing a null pointer (and therefore being completely useless), a rather crude approach for a Java API.
I will update the Java API to use Optionals accordingly. I will also consider removing the Key::isNull and require Key to have a non-null pointer reference.
At least the current behavior contradicts the documentation of the function: @return Key if search successful, null otherwise - Therefore i would consider this a bug.
You're right, I overlooked the docu. According to the docu a fix would be to just return null instead of new Key(null). That is irrelevant though, if you want to change the API.
Steps to Reproduce the Problem
Expected Result
null
should be returned.Actual Result
AssertionError
is thrownSystem Information
Proposed solution
KeySet::lookup(...)
should returnOptional<Key>
and would returnOptional.empty()
ifElektra.INSTANCE.ksLookup(ByName)?
returns null.Workaround for 0.9.5
The text was updated successfully, but these errors were encountered: