It's all about the answers!

Ask a question

OSLC4J: Cannot get a ChangeRequest that contains special characters


Ana-Maria Rosu (489) | asked Jul 14 '21, 4:25 a.m.

Hello everyone,


I am trying to get a ChangeRequest from IBM Jazz using OSLC4J Library, but I have a problem when that ChangeRequest (in IBM called EWM workitem) contains special characters (e.g. quotation marks) in some of the fields.

When the workitem contains quotation marks in the Title or the Description (which are standard dcterms attributes) then the request works and the item is retrieved,

But,

When the special characters are in the extended/custom properties, for example “Requested Due Date Change Reason” custom text field, then it gives me the error HTTP 400 Bad Request caused by illegal instance of Datatype rdf:XMLLiteral (see the stacktrace at the end).

I checked the raw response and all text fields are of type XMLLiteral, so both the title and “Requested Due Date Change Reason” field are XML Literals, the only difference is that the title (and the description) are represented using dcterms and “Requested Due Date Change Reason” is rtc_ext.


StackTrace:

Caused by: org.apache.jena.datatypes.DatatypeFormatException: Lexical form '"test"' is not a legal instance of Datatype[http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral] Bad rdf:XMLLiteral

at org.apache.jena.graph.impl.LiteralLabelImpl.getValue(LiteralLabelImpl.java:338)
at org.apache.jena.graph.Node_Literal.getLiteralValue(Node_Literal.java:44)
at org.apache.jena.rdf.model.impl.LiteralImpl.getValue(LiteralImpl.java:98)
at org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper.handleExtendedPropertyValue(JenaModelHelper.java:1154)
at org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper.fromResource(JenaModelHelper.java:659)
at org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper.createObjectResultList(JenaModelHelper.java:528)
at org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper.fromJenaModel(JenaModelHelper.java:402)
at org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper.unmarshal(JenaModelHelper.java:369)
at org.eclipse.lyo.oslc4j.provider.jena.AbstractOslcRdfXmlProvider.readFrom(AbstractOslcRdfXmlProvider.java:305)

For me it looks like that for extended/properties you have a different mechanism (JenaModelHelper.handleExtendedPropertyValue) to read properties compared to the to the procedure for reading properties from standard domains (like dcterms).

Do you have a solution for this?

Thanks,

Ana

One answer



permanent link
David Honey (1.8k17) | answered Jul 14 '21, 8:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I believe that OSLC4J is part of open-services.net and is not part of any Jazz product. You should ask your question in https://forum.open-services.net/c/sdks/lyo/9.

That Jena exception means you have specified an invalid RDF XMLiteral, and the exception is thrown by Jena. You should look at the Jena documentation, and also look at https://www.w3.org/TR/rdf11-concepts/#section-XMLLiteral. There are some characters that are illegal in XML literals, and there are requirements that the text is well-formed XML.

Comments
Ana-Maria Rosu commented Jul 14 '21, 9:16 a.m.

Hello, David! Thank you for your response, I will also ask on the open-services forum. 

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.