Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserialization of Exception serialized as XML fails #1695

Closed
kmahara opened this issue Jul 7, 2017 · 2 comments
Closed

Deserialization of Exception serialized as XML fails #1695

kmahara opened this issue Jul 7, 2017 · 2 comments

Comments

@kmahara
Copy link

kmahara commented Jul 7, 2017

Deserialize of Exception has failed.
Reproduce code is:

import com.fasterxml.jackson.dataformat.xml.XmlMapper;

public class Test {
	public static void main(String[] args) throws Exception {
		Exception e = new Exception();

		XmlMapper mapper = new XmlMapper();

		String s = mapper.writeValueAsString(e);
		System.out.println(s);

		Exception e2 = mapper.readValue(s, Exception.class);
		String s2 = mapper.writeValueAsString(e2);
		System.out.println(s2);
	}
}

Error reports:

Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: Non-numeric token (VALUE_STRING) for property 'lineNumber'
 at [Source: java.io.StringReader@38bc8ab5; line: 1, column: 116] (through reference chain: java.lang.Object[][0])
	at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
	at com.fasterxml.jackson.databind.DeserializationContext.reportMappingException(DeserializationContext.java:1234)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1122)
	at com.fasterxml.jackson.databind.deser.std.StackTraceElementDeserializer.deserialize(StackTraceElementDeserializer.java:40)
	at com.fasterxml.jackson.databind.deser.std.StackTraceElementDeserializer.deserialize(StackTraceElementDeserializer.java:11)
	at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:196)
	at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:20)
	at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:504)
	at com.fasterxml.jackson.databind.deser.std.ThrowableDeserializer.deserializeFromObject(ThrowableDeserializer.java:103)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3814)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2858)
	at jp.mahara.tumblr.Test.main(Test.java:14)

Maven dependency is:

		<dependency>
			<groupId>com.fasterxml.jackson.jaxrs</groupId>
			<artifactId>jackson-jaxrs-xml-provider</artifactId>
			<version>2.8.9</version>
		</dependency>
@cowtowncoder
Copy link
Member

Thank you for reporting this problem.

Since this is related to XML processing (more likely than databind itself), could you please re-file at:

https://github.com/FasterXML/jackson-dataformat-xml/issues

@cowtowncoder cowtowncoder changed the title Deserialize failed with Exception Deserialization of Exception serialized as XML fails Jul 12, 2017
@cowtowncoder
Copy link
Member

Moved to: FasterXML/jackson-dataformat-xml#250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants