You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Andrea Del Bene (JIRA)" <ji...@apache.org> on 2016/05/06 16:05:12 UTC

[jira] [Updated] (WICKET-6157) WicketTester and application servers are destroying app differently

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

Andrea Del Bene updated WICKET-6157:
------------------------------------
    Affects Version/s: 8.0.0-M1

> WicketTester and application servers are destroying app differently
> -------------------------------------------------------------------
>
>                 Key: WICKET-6157
>                 URL: https://issues.apache.org/jira/browse/WICKET-6157
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.2.0, 8.0.0-M1
>            Reporter: Ilia Naryzhny
>            Assignee: Andrea Del Bene
>              Labels: wicket-tester
>
> It's easy to recieve NPE because of absence of App in context in test during destroying app and it's OK on real app. The reason is the following:
> Wicket Test has just this code:
> ```
> 	public void destroy()
> 	{
> 		application.internalDestroy();
> 		ThreadContext.detach();
> 	}
> ```
> But real filter has this one:
> ```
> @Override
> 	public void destroy()
> 	{
> 		if (application != null)
> 		{
> 			try
> 			{
> 				ThreadContext.setApplication(application);
> 				application.internalDestroy();
> 			}
> 			finally
> 			{
> 				ThreadContext.detach();
> 				application = null;
> 			}
> 		}
> 		if (applicationFactory != null)
> 		{
> 			try
> 			{
> 				applicationFactory.destroy(this);
> 			}
> 			finally
> 			{
> 				applicationFactory = null;
> 			}
> 		}
> 	}
> ```
> So, as you can see filter explicitly setting app, so NPE would not happen, but wicket tester do not. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)