Ilia Naryzhny created WICKET-6157:
-------------------------------------

             Summary: 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
            Reporter: Ilia Naryzhny


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