zafarkhaja / jsemver

Java implementation of the SemVer Specification
MIT License
429 stars 82 forks source link

Add ParseException.getMessage() #39

Closed jsimomaa closed 1 year ago

jsimomaa commented 7 years ago

Overriding getMessage() in order to prevent cases where detailMessage = null in order to provide descriptive messages

See #38 for more detail

zafarkhaja commented 1 year ago

Hello Jani, I hope you're doing well!

Sorry it took me this long to get back to you.

I appreciate you taking the time and effort to contribute, but to be honest I fail to see the value in overriding Throwable.getMessage() like this. I mean the method is there, you can call it and get the message if it's present. And if it's not, calling ParseException.toString() won't help as it ultimately does the same thing, calls the parent's getMessage(). Also, calling any one of them when detailMessage is null results in StackOverflowError as they keep calling each other back and forth :)

zafarkhaja commented 1 year ago

Sorry, initially missed the reference to the issue, somehow.

The details there revealed that the real problem is not in ParseException, but in UnexpectedCharacterException: it doesn't pass any messages to its parent. The proposed change, however, still isn't a good fix as it breaks ParseException. Will fix it soon.

Cheers,