[
https://issues.apache.org/jira/browse/WICKET-4309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13179119#comment-13179119
]
Andrea Del Bene commented on WICKET-4309:
-----------------------------------------
The discussion for this issue is here:
http://mail-archives.apache.org/mod_mbox/wicket-users/201111.mbox/%3ccaevaqhofbzxdnabkeyojka0idt4abhwngqebsxayoysfaxt...@mail.gmail.com%3E
I've attached a patch which applies proposed changes to all toOptionalXXX
methods except toOptionalString.
> StringValueConversionException for correct situation
> ----------------------------------------------------
>
> Key: WICKET-4309
> URL: https://issues.apache.org/jira/browse/WICKET-4309
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.3
> Environment: Java 1.6, Jboss
> Reporter: Ilia Naryzhny
> Labels: StringValue, StringValueConversionException
> Attachments: WICKET-4309.patch
>
>
> StringValue.toOptionalLong() produces
> org.apache.wicket.util.string.StringValueConversionException if empty string
> was passed.
> Let me suggest, that this behavior should be changes for all toOptionalXXX
> methods except getOptionalString method.
> The problem in inner code:
> The problem in following code:
> public final Long toOptionalLong() throws StringValueConversionException
> {
> return (text == null) ? null : toLongObject();
> }
> Should be something like this:
> The problem in following code:
> public final Long toOptionalLong() throws StringValueConversionException
> {
> return Strings.isEmpty() ? null : toLongObject();
> }
> But there is another problem: what to do if incorrect param was passed - for
> example "abc" for parameter of Long type?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira