Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-831

NPE in DefaultMockFilter when running JUnit and the application contains a class in the default package

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.1
    • 1.3.0
    • TestControl
    • None
    • JUnit+Deltaspike+OpenEJB 4.6.0 on Windows 7, Oracle JDK 7

    Description

      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

              return origin != null && (origin.getPackage() == null || !isInternalPackage(origin.getPackage().getName()));
      

      Attachments

        Activity

          People

            gpetracek Gerhard Petracek
            nlbrettstat Tobias Rettstadt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: