Hi,
There are two getTable variants in InjectableBehaviourObjectStore() each
calling corresponding super.getTable() and passing the returned value
to getTableModifier.apply(). ObjectStore, which is super class here, itself
has the same getTable variants. A result is that when one variant of
getTable() which calls another in ObjectStore is called from
InjectableBehaviourObjectStore, it may result in a NULL pointer exception
if the injected apply is not careful about the input value.

E.g let's say the getTable variants are getTable(A) and getTable(B) in
ObjectStore.java.  InjectableBehaviourObjectStore also implements those two
variants calling corresponding variants of super class ObjectStore (using
super.getTable()). With the inheritance the call stack looks like
InjectableBehaviourObjectStore.getTable(A) calls ObjectStore.getTable(A)
calls InjectableBehaviourObjectStore.getTable(A, B) calls
Object.getTable(A, B). If getTable() variants in
InjectableBehaviourObjectStore return NULL, as most of them do, the apply()
method will end up with a NullPointerException if it's not careful about
its input. And not many implementation of apply are careful.

I think this should be fixed in InjectableBehaviourObjectStore(), by
avoiding to apply apply() method i.e injection twice by tracking whether
the apply() method has already been applied already.

Does that sound good?

--
Best Wishes,
Ashutosh Bapat

Reply via email to