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
If I want to return Result.ok and enter null as a value, for certain methods such as isOk, ifOk and similar, a nullPointerException is obtained.
java.lang.NullPointerException: null
at java.base/java.util.Objects.requireNonNull(Objects.java:233) ~[na:na]
at java.base/java.util.Optional.of(Optional.java:113) ~[na:na]
at com.hubspot.algebra.Results.lambda$getOk$3(Results.java:46) ~[algebra-1.5.jar:1.5]
at com.hubspot.algebra.Results$Ok.match(Results.java:104) ~[algebra-1.5.jar:1.5]
at com.hubspot.algebra.Results.getOk(Results.java:45) ~[algebra-1.5.jar:1.5]
at com.hubspot.algebra.Result.isOk(Result.java:32) ~[algebra-1.5.jar:1.5]
The text was updated successfully, but these errors were encountered:
Additional
isOk throw exception because it uses :
/**
* Returns an {@code Optional} describing the given non-{@code null}
* value.
*
* @param value the value to describe, which must be non-{@code null}
* @param the type of the value
* @return an {@code Optional} with the value present
* @throws NullPointerException if value is {@code null}
*/
public static Optional of(T value) {
return new Optional<>(Objects.requireNonNull(value));
}
If I want to return Result.ok and enter null as a value, for certain methods such as isOk, ifOk and similar, a nullPointerException is obtained.
java.lang.NullPointerException: null
at java.base/java.util.Objects.requireNonNull(Objects.java:233) ~[na:na]
at java.base/java.util.Optional.of(Optional.java:113) ~[na:na]
at com.hubspot.algebra.Results.lambda$getOk$3(Results.java:46) ~[algebra-1.5.jar:1.5]
at com.hubspot.algebra.Results$Ok.match(Results.java:104) ~[algebra-1.5.jar:1.5]
at com.hubspot.algebra.Results.getOk(Results.java:45) ~[algebra-1.5.jar:1.5]
at com.hubspot.algebra.Result.isOk(Result.java:32) ~[algebra-1.5.jar:1.5]
The text was updated successfully, but these errors were encountered: