-
Notifications
You must be signed in to change notification settings - Fork 62
Fix instanceof check and cast with pattern matching (#85) #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…t-json-jackson. (operaton#85) Instanceof must not use generics to avoid stack overflows.
...-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DateDataTypeTransformer.java
Outdated
Show resolved
Hide resolved
@@ -63,8 +63,8 @@ public Object invoke(InvocationContext ctx) throws Exception { | |||
return result; | |||
} catch (InvocationTargetException e) { | |||
Throwable cause = e.getCause(); | |||
if(cause != null && cause instanceof Exception) { | |||
throw (Exception) cause; | |||
if (cause != null && cause instanceof Exception exception) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question on how to proceed here: A user commented on a commit some time earlier, that instanceof
is null safe. If the passed parameter is null, it is not an instance of Exception
and the check is false
, skipping the body. Is this something we should already improve here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://docs.oracle.com/javase/specs/jls/se17/html/jls-15.html#jls-15.20.2
At run time, the result of the type comparison operator is determined as follows:
If the value of the RelationalExpression is the null reference (§4.1), then the result is false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the null check is obsolete then
- Syntax fix in DateDataTypeTransformer - remove redundant null check in StartProcessInterceptor
Sorry @dirk-olmes I did not recognize that the findings have already been adressed for a long time. Just ping in a comment. Did you know that you could (re-)request a review when clicking on one of the reviewers in top right? |
🎉 This issue has been resolved in |
related to #85