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

Tobias Rettstadt commented on DELTASPIKE-831:
---------------------------------------------

The ValidationMessages class was only needed because bean validation expects a 
resource bundle named ValidationMessages in the default package, but we wanted 
to keep the resource bundle itself in a package. The class implemented a 
ResourceBundle and just used our resource bundle for all lookups. We cannot use 
any deltaspike annotations in the application itself because there is a company 
policy that limits the this-party libraries we are allowed to use. That's why 
we use deltaspike only for our integration tests.
But I found a work-around now: We simply moved our resource bundle to 
ValidationMessages.properties which means that there is no need anymore for the 
ValidationMessages class. After this change the unit tests are working again.

> NPE in DefaultMockFilter when running JUnit and the application contains a 
> class in the default package
> -------------------------------------------------------------------------------------------------------
>
>                 Key: DELTASPIKE-831
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-831
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: TestControl
>    Affects Versions: 1.2.1
>         Environment: JUnit+Deltaspike+OpenEJB 4.6.0 on Windows 7, Oracle JDK 7
>            Reporter: Tobias Rettstadt
>
> Running a unit test results in a NPE if the application contains a class in 
> the default package. The problem is line 67 of 
> {{org.apache.deltaspike.testcontrol.impl.mock.DefaultMockFilter}} where
> {{isInternalPackage(origin.getPackage().getName())}} is called without 
> checking if {{getPackage()}} returns null.
> Suggested fix: Change line 67 to
> {code}
>         return origin != null && (origin.getPackage() == null || 
> !isInternalPackage(origin.getPackage().getName()));
> {code}



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

Reply via email to