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
WorkflowData was created as an interface, originally envisioning multiple types of data. However, during development we realized it was far easier to just pass around the same single class. Because it's an interface, this requires anonymous subclassing.
Creating an anonymous subclass returning values generated at runtime can be dangerous. One can spend several hours trying to debug why the following sequence hangs the JVM:
finalStrings = inputIndex;
WorkflowDatawfd = newWorkflowData() {
@OverridepublicMap<String, Object> getContent() {
returnMap.of("index", s);
}
};
wfd.getContent(); // hangs creating Map.of if s was null
Using Map.of() with a null key or value causes a NullPointerException which stopped processing without any information on why.
What solution would you like?
Just create a regular class and pass the params and content in as arguments to the constructors. We can even overload the constructors to allow both, or just params, to default to an empty map.
What alternatives have you considered?
Some sort of wrapper class around actual Request and Response objects in OpenSearch. This is overly complicated for our purpose.
Do you have any additional context?
I'd add this to my #47 but the changes also need to be made in #38, #44, and #52. I suggest the PRs that are ready to merge get merged, we fix this, and future development can conform to the new signature before we do any more.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
WorkflowData
was created as an interface, originally envisioning multiple types of data. However, during development we realized it was far easier to just pass around the same single class. Because it's an interface, this requires anonymous subclassing.Creating an anonymous subclass returning values generated at runtime can be dangerous. One can spend several hours trying to debug why the following sequence hangs the JVM:
Using
Map.of()
with a null key or value causes aNullPointerException
which stopped processing without any information on why.What solution would you like?
Just create a regular class and pass the params and content in as arguments to the constructors. We can even overload the constructors to allow both, or just params, to default to an empty map.
What alternatives have you considered?
Some sort of wrapper class around actual
Request
andResponse
objects in OpenSearch. This is overly complicated for our purpose.Do you have any additional context?
I'd add this to my #47 but the changes also need to be made in #38, #44, and #52. I suggest the PRs that are ready to merge get merged, we fix this, and future development can conform to the new signature before we do any more.
The text was updated successfully, but these errors were encountered: