You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2012/07/23 10:27:43 UTC

[jira] [Resolved] (WICKET-4663) LazyInitProxyFactory uses wrong ClassLoader in OSGi environment

     [ https://issues.apache.org/jira/browse/WICKET-4663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4663.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.8
                   6.0.0

Applied your suggestion in 1.5.x.
For 6.x I moved #getClassLoader() method in IClassResolver interface.
                
> LazyInitProxyFactory uses wrong ClassLoader in OSGi environment
> ---------------------------------------------------------------
>
>                 Key: WICKET-4663
>                 URL: https://issues.apache.org/jira/browse/WICKET-4663
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.7
>            Reporter: Stefan
>            Assignee: Martin Grigorov
>             Fix For: 6.0.0, 1.5.8
>
>
> The method LazyInitProxyFactory#createProxy use Thread.currentThread().getContextClassLoader() to create a new proxy instance. It seems that this is not correct in an OSGi environment.
> Preferred is to use the ClassLoader provided by the AbstractClassResolver class (getClassResolver is not part of IClassResolver). 
> Then it will be something like:
> 			ClassLoader classLoader;
> 			if (Application.exists())
> 			{
> 				AbstractClassResolver classResolver = (AbstractClassResolver) Application.get()
> 					.getApplicationSettings()
> 					.getClassResolver();			
> 				classLoader = classResolver.getClassLoader();
> 			}
> 			else
> 			{
> 				classLoader = Thread.currentThread().getContextClassLoader();
> 			}
> 			
> 			try
> 			{
> 				return Proxy.newProxyInstance(classLoader, new Class[] { type, Serializable.class,
> 						ILazyInitProxy.class, IWriteReplace.class }, handler);
> 			}

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