Open bhyatm opened 8 months ago
@bhyatm Could you attach sample XML and Employee structure class? What does it mean 'c'? I wrote a sample code in jaxb-runtime test class:
private static JAXBContext context;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
context = JAXBContext.newInstance(Employee.class);
}
@Test
public void unmarshallEmployee() throws JAXBException {
StringReader reader = new StringReader("<employee><name>bhyatm</name></employee>");
StreamSource source1 = new StreamSource(reader);
Unmarshaller jaxbUnmarshaller = context.createUnmarshaller();
Employee emp = jaxbUnmarshaller.unmarshal(source1, Employee.class).getValue();
Assert.assertEquals("bhyatm", emp.getName());
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "employee")
private static class Employee {
@XmlElement
private String name;
public String getName() {
return this.name;
}
}
Regards, Antonio.
Hi,
I am having an issue with the UnMarshallerImpl
I have a simple XML String which I am trying to convert to POJO
However everytime I do I get a stream is closed IOException
I have narrowed it down to the the logic in the UnmarshallerImp which converts the Incoming Stream Source into an InputSource
The streamSourceToInputSource code works fine, but the output of that when returned set the stringreader str to null (somehow) and that results in in the error
I am using OpenJDK 21.0.2 on a mac with runtime version 4.0.1 (latest)
anyone had this issue ?