glassfish
  1. glassfish
  2. GLASSFISH-14529

WarScanner throws NPE when invoked from verifier

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1_b28
    • Component/s: deployment
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      14,529

      Description

      I have started to revisit all verifier bugs. With my local changes, when I run
      verifier against a war, I get the following exception:
      java.lang.NullPointerException
      at
      com.sun.enterprise.deployment.annotation.impl.ModuleScanner.calculateResults(ModuleScanner.java:143)
      at
      com.sun.enterprise.deployment.annotation.impl.WarScanner.process(WarScanner.java:146)
      at
      com.sun.enterprise.deployment.annotation.impl.WarScanner.process(WarScanner.java:71)
      at
      com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:552)
      at
      org.glassfish.web.embed.impl.EmbeddedWebArchivist.processAnnotations(EmbeddedWebArchivist.java:126)
      at
      com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:440)
      at
      com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:427)
      at
      com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:403)
      at
      com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:378)
      at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:243)
      at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:252)
      at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:213)
      at
      com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:165)
      at
      com.sun.enterprise.tools.verifier.DescriptorFactory.createApplicationDescriptor(DescriptorFactory.java:154)
      at com.sun.enterprise.tools.verifier.Verifier.initStandalone(Verifier.java:381)
      at com.sun.enterprise.tools.verifier.Verifier.init(Verifier.java:189)
      at com.sun.enterprise.tools.verifier.Main.main(Main.java:80)

      The patch below solves the issue. Please apply if you are satisfied.

      ss141213@Sahoo:/space/ss141213/WS/gf/v3$ svn diff deployment/
      Index:
      deployment/dol/src/main/java/com/sun/enterprise/deployment/annotation/impl/WarScanner.java
      ===================================================================

      deployment/dol/src/main/java/com/sun/enterprise/deployment/annotation/impl/WarScanner.java
      (revision 42543)
      +++
      deployment/dol/src/main/java/com/sun/enterprise/deployment/annotation/impl/WarScanner.java
      (working copy)
      @@ -48,6 +48,7 @@
      import org.glassfish.apf.impl.AnnotationUtils;
      import org.glassfish.api.deployment.archive.ReadableArchive;
      import org.glassfish.hk2.classmodel.reflect.Parser;
      +import org.glassfish.hk2.classmodel.reflect.ParsingContext;
      import org.glassfish.internal.api.ClassLoaderHierarchy;
      import org.jvnet.hk2.annotations.Inject;
      import org.jvnet.hk2.annotations.Scoped;
      @@ -101,6 +102,12 @@

      this.archiveFile = new File(readableArchive.getURI());
      this.classLoader = classLoader;
      + if (parser == null)

      { + ParsingContext.Builder builder = new ParsingContext.Builder(); + builder.logger(logger); + ParsingContext pc = builder.build(); + parser = new Parser(pc); + }

      this.classParser = parser;

      if (AnnotationUtils.getLogger().isLoggable(Level.FINE)) {

        Activity

        Hide
        Hong Zhang added a comment -

        The patch looks good. Thanks for reporting the issue and providing the patch. I
        checked the other scanners to see if we need similar changes there, seems the
        AppClientScanner already has similar logic, so we should be all set with your
        patch.

        Show
        Hong Zhang added a comment - The patch looks good. Thanks for reporting the issue and providing the patch. I checked the other scanners to see if we need similar changes there, seems the AppClientScanner already has similar logic, so we should be all set with your patch.
        Hide
        Hong Zhang added a comment -

        applied the patch

        Show
        Hong Zhang added a comment - applied the patch

          People

          • Assignee:
            Hong Zhang
            Reporter:
            Sanjeeb Sahoo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: