You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Maurizio Cucchiara (Commented) (JIRA)" <ji...@apache.org> on 2011/10/28 12:22:32 UTC

[jira] [Commented] (WW-3695) XWorkConverter catch XWorkException so that the client application can't get the detail original error message

    [ https://issues.apache.org/jira/browse/WW-3695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13138205#comment-13138205 ] 

Maurizio Cucchiara commented on WW-3695:
----------------------------------------

As you can see there is an {{handleConversionException}} which is delegated to manage this kind of condition (it adds conversion errors to the action context).
So, whenever an user add a value which causes a conversion error, if I understand correctly should add a conversion error, which triggers the input result.
I could be wrong, I probably didn't get you, could you provide a test case or a more detailed example?
                
> XWorkConverter catch XWorkException so that the client application can't get the detail original error message
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3695
>                 URL: https://issues.apache.org/jira/browse/WW-3695
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Other
>    Affects Versions: 2.2.1.1
>            Reporter: shenjc
>
> in com.opensymphony.xwork2.conversion.impl.XWorkConverter line 331 to 341
> {code}
> try {
>     if (LOG.isDebugEnabled())
>         LOG.debug("falling back to default type converter [" + defaultTypeConverter + "]");
>     return defaultTypeConverter.convertValue(context, target, member, property, value, toClass);
> } catch (Exception e) {
>     if (LOG.isDebugEnabled())
>         LOG.debug("unable to convert value using type converter [#0]", e, defaultTypeConverter.getClass().getName());
>     handleConversionException(context, property, value, target);
>     return TypeConverter.NO_CONVERSION_POSSIBLE;
> }
> {code}
> here try catch code "defaultTypeConverter.convertValue" so that it can not throw exception to outside.
> in some case,for example:
> when I transmit a param a bigInteger to Integer in a action.
> the program will run pass and ignore this exception,the outside program can't catch it ,so that can't find what cause the error.
> and it only print in log file:
> {noformat}
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger.debug(72) | unable to convert value using type converter [com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter]
> Overflow or underflow casting: "3322333330" into class java.lang.Long - [unknown location]
> {noformat}
> and we need to find this  error message in large debug log message;
>  
> I think, throw this exception and not catch it here,and change log level from debug to error when print this message will better,isn't it ?

--
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