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 (Updated) (JIRA)" <ji...@apache.org> on 2011/10/28 10:58:32 UTC

[jira] [Updated] (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:all-tabpanel ]

Maurizio Cucchiara updated WW-3695:
-----------------------------------

    Description: 
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 ?

  was:
in com.opensymphony.xwork2.conversion.impl.XWorkConverter line 331 to 341
            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;
            }
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:
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]

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 ?

    
> 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