I tried debugging this and it looks like a bug in the tokenizer. I am parsing XML using Jackson and am working on the following line:
<w lemma="2377" n="1.0" morph="HNcmsc" id="31xeN">חֲז֖וֹן</w>
I am parsing into the following code:
package org.forerunnerintl.xlate.text.osis;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
public class OsisWord {
private String id;
private String lemma;
private String morph;
@JacksonXmlProperty(isAttribute = true, localName = "n")
private String noteId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLemma() {
return lemma;
}
public void setLemma(String lemma) {
this.lemma = lemma;
}
public String getMorph() {
return morph;
}
public void setMorph(String morph) {
this.morph = morph;
}
public String getNoteId() {
return noteId;
}
public void setNoteId(String noteId) {
this.noteId = noteId;
}
}
And here's my error:
java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "" (class org.forerunnerintl.xlate.text.osis.OsisWord), not marked as ignorable (4 known properties: "lemma", "id", "n", "morph"])
at [Source: (File); line: 321, column: 72] (through reference chain: org.forerunnerintl.xlate.text.osis.OsisDocument["osisText"]->org.forerunnerintl.xlate.text.osis.OsisText["div"]->org.forerunnerintl.xlate.text.osis.OsisBook["chapter"]->java.util.ArrayList[0]->org.forerunnerintl.xlate.text.osis.OsisChapter["verse"]->java.util.ArrayList[0]->org.forerunnerintl.xlate.text.osis.OsisVerse["w"]->java.util.ArrayList[0]->org.forerunnerintl.xlate.text.osis.OsisWord[""])
at org.forerunnerintl.xlate.text.osis.OsisReader.readFile(OsisReader.java:17)
at org.forerunnerintl.xlate.text.OsisReaderTest.Read OSIS(OsisReaderTest.groovy:24)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "" (class org.forerunnerintl.xlate.text.osis.OsisWord), not marked as ignorable (4 known properties: "lemma", "id", "n", "morph"])
at [Source: (File); line: 321, column: 72] (through reference chain: org.forerunnerintl.xlate.text.osis.OsisDocument["osisText"]->org.forerunnerintl.xlate.text.osis.OsisText["div"]->org.forerunnerintl.xlate.text.osis.OsisBook["chapter"]->java.util.ArrayList[0]->org.forerunnerintl.xlate.text.osis.OsisChapter["verse"]->java.util.ArrayList[0]->org.forerunnerintl.xlate.text.osis.OsisVerse["w"]->java.util.ArrayList[0]->org.forerunnerintl.xlate.text.osis.OsisWord[""])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:1153)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:2224)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1719)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1697)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:316)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:359)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:359)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:359)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
at com.fasterxml.jackson.dataformat.xml.deser.XmlDeserializationContext.readRootValue(XmlDeserializationContext.java:104)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4899)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3711)
at org.forerunnerintl.xlate.text.osis.OsisReader.readFile(OsisReader.java:15)
... 1 more
Column 72 is at the end of the line, BTW.
You can recreate the error by running the spock test OsisReaderTest directly or by running gradlew test from the command line.
This is com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.16.0.
Thanks.