commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Franklin Phan (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (BEANUTILS-353) Unable to call isUseDefault() to check whether a default value will be returned
Date Mon, 03 Aug 2009 17:27:14 GMT

    [ https://issues.apache.org/jira/browse/BEANUTILS-353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735782#action_12735782
] 

Franklin Phan edited comment on BEANUTILS-353 at 8/3/09 10:25 AM:
------------------------------------------------------------------

Even calling a getter here is unsafe?
My intention was to have a way of checking before unnecessarily instantiating and registering
a SqlTimestampConverter that returns default NULL every time:

{code}
Converter converter = BeanUtilsBean.getInstance().getConvertUtils().lookup(java.sql.Timestamp.class)
if (!converter.isUseDefault()) { // But unfortunately, this check is invalid!
    BeanUtilsBean.getInstance().getConvertUtils().register(new SqlTimestampConverter(null),
java.sql.Timestamp.class);
}
{code}

      was (Author: fphan):
    Even calling a getter here is unsafe?
My intention was to have a way of checking before unnecessarily instantiating and registering
a SqlTimestampConverter that returns default NULL every time:

Converter converter = BeanUtilsBean.getInstance().getConvertUtils().lookup(java.sql.Timestamp.class);
if (!converter.isUseDefault()) { // But unfortunately, this check is invalid!
    BeanUtilsBean.getInstance().getConvertUtils().register(new SqlTimestampConverter(null),
java.sql.Timestamp.class);
}
  
> Unable to call isUseDefault() to check whether a default value will be returned
> -------------------------------------------------------------------------------
>
>                 Key: BEANUTILS-353
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-353
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: ConvertUtils & Converters
>    Affects Versions: 1.8.0
>         Environment: WinXP Pro, JDK 1.6.0_14, Tomcat 5.5.27
>            Reporter: Franklin Phan
>
> One can never call isUseDefault() to check on a Converter given the way you have ConverterFacade
designed and in ConvertUtilsBean:
> {{
>     private void register(Class clazz, Converter converter) {
>         register(new ConverterFacade(converter), clazz);
>     }
> }}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message