Rune Stilling created JENA-487:
----------------------------------
Summary: CannotEncodeCharacterException when writing lots of
instances to file via RDFWriter
Key: JENA-487
URL: https://issues.apache.org/jira/browse/JENA-487
Project: Apache Jena
Issue Type: Bug
Components: RDF/XML
Affects Versions: Jena 2.10.1
Environment: Windows 64 bit
Reporter: Rune Stilling
Priority: Minor
I'm using the following code to write a model to a file:
RDFWriter w = model.getWriter("RDF/XML"); //-ABBREV (abbrev will
produce rdf:seq, the other wont)
w.setProperty("showXMLDeclaration", "true");
w.setProperty("showDoctypeDeclaration", "true");
w.setProperty("xmlbase", xmlBase);
File saveFile = new File(fileName);
FileOutputStream fso = null;
try {
fso = new FileOutputStream(saveFile);
} catch (Exception e) {
e.printStackTrace();
}
w.write(model, fso, "RDF/XML");
fso.close();
If I run this with 10000 instances it works, if I run it with 20000 instances
the write fails with the following exception:
com.hp.hpl.jena.shared.CannotEncodeCharacterException: cannot encode (char) ↔
in context XML
at
com.hp.hpl.jena.rdf.model.impl.Util.substituteEntitiesInElementContent(Util.java:175)
at com.hp.hpl.jena.xmloutput.impl.Basic.writeLiteral(Basic.java:176)
at com.hp.hpl.jena.xmloutput.impl.Basic.writePredicate(Basic.java:112)
at
com.hp.hpl.jena.xmloutput.impl.Basic.writeRDFStatements(Basic.java:85)
at
com.hp.hpl.jena.xmloutput.impl.Basic.writeRDFStatements(Basic.java:74)
at com.hp.hpl.jena.xmloutput.impl.Basic.writeBody(Basic.java:48)
at
com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.writeXMLBody(BaseXMLWriter.java:492)
at
com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:464)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.write(ModelCom.java:319)
at dk.rdfined.rdf.jena.Utils.WriteModelToFile2(Utils.java:51)
at
textanalyzerhelper.ritzau.TelegramExporter.export(TelegramExporter.java:49)
at textanalyzerhelper.Main.main(Main.java:135)
This problem seems to parallel with the report I found here:
https://www.coderanch.com/t/466480/java/java/JenaOWLModel-save-throw-errors-save
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira