-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Looking at masesgroup/KEFCore#448 and analyzing the code:
https://github.com/masesgroup/KNet/blob/024d22b6e15a7fd2725b4b83d563cb742d9dfa90/src/jvm/knet/src/main/java/org/mases/knet/generated/org/apache/kafka/streams/processor/TimestampExtractor.java#L73-L77
- the first issue is related to a missing assignment of the return value in the
JNetEventResult: the defaultnullis returned back and the unboxing conversion fails raisingjava.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because "retVal" is null- the second issue is related to a similar condition since the function
getHasOverrideprobably returns the default value which isfalseThe
JNetEventResultinstance is created locally and theextractmethod invokes thesynchronizedmethod https://github.com/masesgroup/KNet/blob/024d22b6e15a7fd2725b4b83d563cb742d9dfa90/src/jvm/knet/src/main/java/org/mases/knet/generated/org/apache/kafka/streams/processor/TimestampExtractor.java#L45-L48The code of
JNetEventResultis very simple:public class JNetEventResult { boolean _hasOverride = false; Object _returnData; public boolean getHasOverride() { return _hasOverride; } public void setHasOverride(boolean hasOverride) { _hasOverride = hasOverride; } public Object getReturnData() { return _returnData; } public void setReturnData(Object retData) { _returnData = retData; } public void setReturnData(boolean hasOverride, Object retData) { _hasOverride = hasOverride; _returnData = retData; } }but for the second issue seems clear that the default value is returned from
getHasOverride.
Maybe it can be an option to replace the_hasOverridefield with a type that accept to be a three state or verify if the value was returned adding an extra field updated whensetReturnDataorsetHasOverrideare invoked: if the optional boolean field is still false thegetHasOverridecan raise an internal exception since no one updated its internal value.
Shall be checked if the methodsetReturnDatawith one parameter is in use: otherwise the one with two parameter can change its name to avoid method matching confusion, leaving the value of_hasOverrideto its default value.
Anyway an update on JNet shall be made to verify the previous assumptions.
Originally posted by @masesdevelopers in #1058