[
https://issues.apache.org/jira/browse/BEANUTILS-353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738264#action_12738264
]
Franklin Phan commented on BEANUTILS-353:
-----------------------------------------
I am not understanding how this "per-classloader" feature works. I have two
instances of Tomcat 5.5.27 running on separate machines (one Linux and one
WinXP). Each Tomcat are set up similarly and runs the same copy of a webapp.
Each webapp has a Filter whose init method registers a differently configured
implementation of SqlTimestampConverter:
{{BeanUtilsBean.getInstance().getConvertUtils().register(new
SqlTimestampConverter(null), java.sql.Timestamp.class);}}
Using NetBeans Debugger, I can see that during server startup, the init method
is called for both webapps and a new instance of BeanUtilsBeans (containing the
corrected SqlTimestampConverter) is stored in the {{valueByClassLoader}} Map in
ContextClassLoaderLocal--each converter mapped by the ContextClassLoader.
Later, when the webapps are called again via a different action, one webapp
retrieves the same BeanUtilsBeans from the {{valueByClassLoader}} Map while the
other webapp gets a different ContextClassLoader and creates a second, new
instance of BeanUtilsBeans with all the default Converters via the
{{ConvertUtilsBean.deregister}} method and stores it in the
{{valueByClassLoader}} Map. This new instance of BeanUtilsBeans contains, of
course, the incorrect SqlTimestampConverter; and {{valueByClassLoader}} Map now
contains two BeanUtilsBeans. What's causing this discrepant behavior in the
latter Tomcat/webapp?
> 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.