[ 
https://issues.apache.org/jira/browse/WICKET-6157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15274662#comment-15274662
 ] 

ASF subversion and git services commented on WICKET-6157:
---------------------------------------------------------

Commit 95863397de43ca4e42cd6649577ea1f279c53c3b in wicket's branch 
refs/heads/master from [~bitstorm]
[ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=9586339 ]

WICKET-6157 WicketTester and application servers are destroying app differently


> 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
>            Priority: Minor
>              Labels: wicket-tester
>             Fix For: 8.0.0-M1, 7.4.0
>
>
> 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)

Reply via email to