eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
205 stars 111 forks source link

NullPointerException - com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get with @XmlValue and generics #850

Open Tomas-Kraus opened 13 years ago

Tomas-Kraus commented 13 years ago

I've a class with generics like this :

@XmLRootElement
public class NillableValue<E> {
    private boolean _nillable = false;
    private E _value = null;

    @XmlAttribute(name="null")
    public boolean isNillable() {
    return _nillable;
    }

    @XmlValue   
    public E getValue() {
    return _value;
    }

    // Setter here }

And another like this :

@XmLRootElement
public class NillableStringValue extends NillableValue<E> {}

When i try to marshall NillableStringValue, got :

java.lang.NullPointerException
    at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccessor.java:169)

This works if i replace @XmlValue by @XmlElement and when I don't use generics

Environment

Windows XP

Affected Versions

[2.2.4u1]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 13 years ago

@glassfishrobot Commented Reported by melbichon

Tomas-Kraus commented 8 years ago

@glassfishrobot Commented herr-herner said: I am confronted with the same issue. The built-in JAXB implementation seems to have a problem when it should marshal objects of type Object in combination with tt>@XmlValue</tt. It's time to get rid of this bug.

Tomas-Kraus commented 13 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-850