jax-ws
  1. jax-ws
  2. JAX_WS-461

NPE when a return type is not found by the apt

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: 2.2.2
    • Component/s: wsgen
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      461
    • Tags:

      Description

      APT throws NPE when a return type for a WebMethod is not found.

      D:\work\jax-ws-sources\test-rearch\test\src\fromjava\nosei_bare_apt\server\EchoI
      mpl.java:17: cannot find symbol
      symbol : class Foo
      location: package fromjava.nosei_bare.server
      public fromjava.nosei_bare.server.Foo echoBar(fromjava.nosei_bare.server.Bar
      param) throws fromjava.nosei_bare.server.Exception1 {
      ^
      warning: Annotation types without processors: [javax.xml.bind.annotation.XmlType
      , javax.xml.bind.annotation.XmlElement, javax.xml.bind.annotation.XmlTransient]
      Problem encountered during annotation processing;
      see stacktrace below for more information.
      java.lang.NullPointerException
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.isSubtype(
      WebServiceAP.java:360)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.isRemote(W
      ebServiceAP.java:355)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLeg
      alType(WebServiceVisitor.java:770)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLeg
      alMethod(WebServiceVisitor.java:618)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.metho
      dsAreLegal(WebServiceVisitor.java:588)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLeg
      alImplementation(WebServiceVisitor.java:506)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.shoul
      dProcessWebService(WebServiceVisitor.java:320)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.visit
      ClassDeclaration(WebServiceVisitor.java:123)
      at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(Clas
      sDeclarationImpl.java:95)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel
      (WebServiceAP.java:326)
      at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.process(We
      bServiceAP.java:267)
      at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.
      process(AnnotationProcessors.java:60)
      at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
      at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:448)
      at com.sun.tools.apt.main.Main.compile(Main.java:1075)
      at com.sun.tools.apt.main.Main.compile(Main.java:938)
      at com.sun.tools.apt.Main.processing(Main.java:95)
      at com.sun.tools.apt.Main.process(Main.java:43)
      at com.sun.tools.apt.Main.main(Main.java:34)
      D:\work\jax-ws-sources\test-rearch\test\src\fromjava\nosei_bare_apt\server\EchoI
      mpl.java:17: cannot find symbol
      symbol : class Foo
      location: package fromjava.nosei_bare.server
      public fromjava.nosei_bare.server.Foo echoBar(fromjava.nosei_bare.server.Bar
      param) throws fromjava.nosei_bare.server.Exception1 {
      ^
      1 error

        Activity

        Hide
        ramapulavarthi added a comment -

        assigning to myself

        Show
        ramapulavarthi added a comment - assigning to myself
        Hide
        ramapulavarthi added a comment -

        Put a fix to check if the TypeDeclaration for the DeclaredType is null and throw
        appropriate exception.
        This can be null when this type's declaration is unknown. This may be the result
        of a processing error, such as a missing class file.

        Show
        ramapulavarthi added a comment - Put a fix to check if the TypeDeclaration for the DeclaredType is null and throw appropriate exception. This can be null when this type's declaration is unknown. This may be the result of a processing error, such as a missing class file.
        Hide
        henryju added a comment -

        Do you really feel this is fixed? I have the same issue, and looking at the
        code, I doubt the fix was tested:

        if(typeDecl == null)

        { // can be null, if this type's declaration is unknown. This may be the result of a processing error, such as a missing class file. builder.onError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(typeDecl.toString(), context.getRound())); }

        Calling typeDecl.toString() when we know it is null seems to be a bad things right?

        Show
        henryju added a comment - Do you really feel this is fixed? I have the same issue, and looking at the code, I doubt the fix was tested: if(typeDecl == null) { // can be null, if this type's declaration is unknown. This may be the result of a processing error, such as a missing class file. builder.onError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(typeDecl.toString(), context.getRound())); } Calling typeDecl.toString() when we know it is null seems to be a bad things right?
        Hide
        ramapulavarthi added a comment -

        Seems like its not tested properly.
        It should have been
        builder.onError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(type.toString(),
        context.getRound()));

        Thanks for bringing this up. It will be fixed in the next release (2.2.1).

        Show
        ramapulavarthi added a comment - Seems like its not tested properly. It should have been builder.onError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(type.toString(), context.getRound())); Thanks for bringing this up. It will be fixed in the next release (2.2.1).
        Hide
        ramapulavarthi added a comment -

        Adding keyword 2.1.x

        Show
        ramapulavarthi added a comment - Adding keyword 2.1.x
        Hide
        ramapulavarthi added a comment -

        This is fixed in 2.2.2 RI.
        Fixed in com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.1.42.2.5

        Show
        ramapulavarthi added a comment - This is fixed in 2.2.2 RI. Fixed in com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.1.42.2.5

          People

          • Assignee:
            ramapulavarthi
            Reporter:
            ramapulavarthi
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: