Uploaded image for project: 'ShrinkWrap'
  1. ShrinkWrap
  2. SHRINKWRAP-290

NPE in ContainerBase.fileFromResource if the specified argument does not exist

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0-beta-4
    • None
    • None
    • None

      We're missing some good precondition checks in place.

      Erring code:

      final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "ejb-security-test.jar");
      jar.addPackage(AnnotatedSLSB.class.getPackage());
      jar.addAsManifestResource("ejb/security/ejb-jar.xml", "ejb-jar.xml"); // HERE, if the file in the first arg does not exist
      return jar;

      Makes:

      Caused by: java.lang.NullPointerException
      at org.jboss.shrinkwrap.impl.base.container.ContainerBase.fileFromResource(ContainerBase.java:1481)
      at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addAsManifestResource(ContainerBase.java:547)
      at org.jboss.as.test.spec.ejb3.security.EJBSecurityTestCase.createDeployment(EJBSecurityTestCase.java:47)
      ... 55 more

              iapazmino_jira Iván Pazmiño (Inactive)
              arubinge@redhat.com Andrew Rubinger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: