Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8169845

Cannot marshal a DataHandler annotated as @XmlAttachmentRef

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 9
    • Fix Version/s: tbd_minor
    • Component/s: xml
    • Labels:
    • Subcomponent:

      Description

      Failed to generate a schema from the following java file(it comes from http://download.java.net/java/jdk9/docs/api/javax/xml/bind/annotation/XmlAttachmentRef.html):
      import javax.xml.bind.annotation.XmlAttachmentRef;
      import javax.xml.bind.annotation.XmlElement;
      import javax.xml.bind.annotation.XmlRootElement;
      import javax.xml.bind.annotation.XmlAttribute;
      import javax.activation.DataHandler;
       
      @XmlRootElement
      class Foo {
         @XmlAttachmentRef
         @XmlAttribute
         DataHandler data;
       
         @XmlAttachmentRef
         @XmlElement
         DataHandler body;
      }
       
      with the following error:
      schemagen Foo.java
      Nov 16, 2016 3:56:54 PM com.sun.tools.internal.jxc.SchemaGenerator run
      SEVERE: null
      java.lang.reflect.InvocationTargetException
               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
               at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
               at java.base/java.lang.reflect.Method.invoke(Method.java:537)
               at jdk.xml.bind@9-ea/com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:154)
               at jdk.xml.bind@9-ea/com.sun.tools.internal.jxc.SchemaGenerator.run(SchemaGenerator.java:76)
               at jdk.xml.bind@9-ea/com.sun.tools.internal.jxc.SchemaGenerator.main(SchemaGenerator.java:67)
      Caused by: java.lang.RuntimeException: java.lang.NullPointerException
               at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:151)
               at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
               at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
               at jdk.xml.bind@9-ea/com.sun.tools.internal.jxc.SchemaGenerator$Runner.compile(SchemaGenerator.java:254)
               ... 7 more
      Caused by: java.lang.NullPointerException
               at jdk.compiler/com.sun.tools.javac.model.JavacTypes.getDeclaredType(JavacTypes.java:235)
               at jdk.xml.bind@9-ea/com.sun.tools.internal.jxc.model.nav.ApNavigator.use(ApNavigator.java:206)
               at jdk.xml.bind@9-ea/com.sun.tools.internal.jxc.model.nav.ApNavigator.use(ApNavigator.java:67)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.core.Adapter.<init>(Adapter.java:73)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.PropertyInfoImpl.<init>(PropertyInfoImpl.java:127)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.SingleTypePropertyInfoImpl.<init>(SingleTypePropertyInfoImpl.java:60)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.AttributePropertyInfoImpl.<init>(AttributePropertyInfoImpl.java:48)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.createAttributeProperty(ClassInfoImpl.java:904)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.addProperty(ClassInfoImpl.java:861)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.findFieldProperties(ClassInfoImpl.java:393)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:296)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:246)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:212)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:360)
               at java.xml.bind@9-ea/com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:375)
               at jdk.xml.bind@9-ea/com.sun.tools.internal.jxc.api.impl.j2s.JavaCompilerImpl.bind(JavaCompilerImpl.java:80)
               at jdk.xml.bind@9-ea/com.sun.tools.internal.jxc.ap.SchemaGenerator.process(SchemaGenerator.java:95)
               at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:959)
               at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:875)
               at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2100(JavacProcessingEnvironment.java:106)
               at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1182)
               at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1290)
               at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1261)
               at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:939)
               at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl$1.call(JavacTaskImpl.java:104)
               at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl$1.call(JavacTaskImpl.java:100)
               at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:135)
               ... 10 more

        Attachments

          Activity

            People

            • Assignee:
              dkral David Kral
              Reporter:
              fyuan Frank Yuan (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: