Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

If state conversion fails use original value instead of null #3546

Merged

Conversation

triller-telekom
Copy link
Contributor

Fixes #3520
Fixes #3530
Fixes #3539

Signed-off-by: Stefan Triller stefan.triller@telekom.de

Signed-off-by: Stefan Triller <stefan.triller@telekom.de>
@maggu2810
Copy link
Contributor

WRT to @SJKA comment about changing the as function (which should be kept as it is IMHO) I would add another option:
Create a asOrDefault method similar to the new one in e.g. Map interface (https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#getOrDefault-java.lang.Object-V-)

So you could call e.g.

applyState(state.asOrDefault(HSBType.class, state));

@kaikreuzer
Copy link
Contributor

@maggu2810 I would refrain from adding a asOrDefaultmethod - this would be a new public API and I do not really see a use case where this would be needed. And if there is no real use case that anyone requests, I would not want to broaden the API unnecessarily.

Copy link
Contributor

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR changes the code to look & work the same way as it was before - so I would be fine to merge it as is.

@kaikreuzer
Copy link
Contributor

@maggu2810 As this addresses 3 critical issue, I hope you are fine to merge it as is - any further changes can be done in upcoming PRs.

@kaikreuzer kaikreuzer merged commit 3384a83 into eclipse-archived:master May 30, 2017
@maggu2810
Copy link
Contributor

Didn't this PR shows that there are already three code parts that use the same logic?
As it could be implemented as a default method in the interface I don't see not a problem on adding this method to the API.
But if you don't like it I don't care but IMHO asOrDefault does make the same sense as providing an as function that return value needs to be checked.

@triller-telekom triller-telekom deleted the fixNPEConversion branch May 31, 2017 11:49
@kaikreuzer kaikreuzer modified the milestone: 0.9.0 Jun 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants