Fixes issue #plantuml#1411: hyperlinkUnderline causes NumberFormatException #1775
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #1411 was a report that:
skinparam hyperlinkUnderline true
was causing a stackdump, showing NumberFormatException.
skinparam hyperlinkUnderline false
on the other hand worked just fine. I found the solution before I fully understood the full process, but now I realize that the value set on hyperlinkUnderline ultimately is converted to a value for the param hyperlinkUnderlineThickness, and to do so, the value needs to be converted to a number. This is what
FromSkinparamToStyle.covertNow(..)
does currently, at least partly, for only the "false" condition, converting it to a 0. However, the "true" condition doesn't get converted here, so when a toDouble() is later called on it in Style.getStroke() that causes an exception.My fix is simple. I just complete
FromSkinparamToStyle.covertNow(..)
to convert a "true" setting on "hyperlinkunderline" to a "1" -- complementing the conversion of "false" to 0. With this simple fix, the param works as expected and the stack dump is avoided.During the analysis of this issue, however, there are some new questions/issues related to "hyperlinkunderlineThickness", when at least for PNG it actually can increase the thickness of the underline for some entities, e.g. State, Activity, but not for others, e.g. Class, and then only in PNG, not SVG (for instance). I believe a new issue will be created for that one. For now, I just wanted to get the stackdump problem on hyperlineunderline true taken care of.
As always, let me know if you need me to make any changes to this fix. It's just two lines so hopefully it's good to go. (The analysis tends to be longer than the solution. But that's how it goes.)
Regards,
Jim Nelson