Deserialization Error with java library v4.0.8 #5
Description
When updating the Infomodel and Infomodel Serializer version in the Dataspace Connector to v4.0.8, we noticed some misbehavior for object deserialization. This causes test fails and avoids upgrading to this version, as we rely on proper deserialization for functionality as it used to work with older versions.
I provided three examples. In all of them, I use the builder classes and toRdf()
method to create IDS objects. Then, I try to convert exactly these strings back to IDS objects using the Serializer.deserialize(String serialization, Class<T> valueType)
method.
1. ConnectorEndpoint: everything works fine
IDS object (as RDF):
{
"@context" : {
"ids" : "https://w3id.org/idsa/core/"
},
"@type" : "ids:ConnectorEndpoint",
"@id" : "https://w3id.org/idsa/autogen/connectorEndpoint/0b82f8f2-5180-467c-b0f7-36aebca206ff",
"ids:accessURL" : {
"@id" : "https://test.com"
}
}
IDS object after deserialization (from IntelliJ debug console):
2. ConfigurationModel: error
IDS object (as RDF):
{
"@context" : {
"ids" : "https://w3id.org/idsa/core/",
"idsc" : "https://w3id.org/idsa/code/"
},
"@type" : "ids:ConfigurationModel",
"@id" : "configId",
"ids:keyStore" : {
"@id" : "file:///conf/keystore.p12"
},
"ids:connectorStatus" : {
"@id" : "https://w3id.org/idsa/code/CONNECTOR_ONLINE"
},
"ids:trustStore" : {
"@id" : "file:///conf/truststore.p12"
},
"ids:connectorProxy" : [ {
"@type" : "ids:Proxy",
"@id" : "proxiId",
"ids:proxyURI" : {
"@id" : "proxy.dortmund.isst.fraunhofer.de:3128"
},
"ids:noProxy" : [ {
"@id" : "https://localhost:8080/"
} ],
"ids:proxyAuthentication" : {
"@type" : "ids:BasicAuthentication",
"@id" : "basicAuthId"
}
} ],
"ids:configurationModelLogLevel" : {
"@id" : "https://w3id.org/idsa/code/NO_LOGGING"
},
"ids:connectorDescription" : {
"@type" : "ids:BaseConnector",
"@id" : "connectorId",
"ids:publicKey" : {
"@type" : "ids:PublicKey",
"@id" : "keyId",
"ids:keyType" : {
"@id" : "https://w3id.org/idsa/code/RSA"
},
"ids:keyValue" : "WW91ciBkYXBzIHRva2VuIGhlcmUu"
},
"ids:version" : "v3.0.0",
"ids:description" : [ {
"@value" : "IDS Connector with static example resources hosted by the Fraunhofer ISST.",
"@type" : "http://www.w3.org/2001/XMLSchema#string"
} ],
"ids:title" : [ {
"@value" : "Dataspace Connector",
"@type" : "http://www.w3.org/2001/XMLSchema#string"
} ],
"ids:securityProfile" : {
"@id" : "https://w3id.org/idsa/code/BASE_SECURITY_PROFILE"
},
"ids:maintainer" : {
"@id" : "https://example.com"
},
"ids:curator" : {
"@id" : "https://example.com"
},
"ids:inboundModelVersion" : [ "4.0.0" ],
"ids:outboundModelVersion" : "4.0.0",
"ids:hasDefaultEndpoint" : {
"@type" : "ids:ConnectorEndpoint",
"@id" : "endpointId",
"ids:accessURL" : {
"@id" : "/api/ids/data"
}
}
},
"ids:connectorDeployMode" : {
"@id" : "https://w3id.org/idsa/code/TEST_DEPLOYMENT"
}
}
IDS object after deserialization (from IntelliJ debug console):
We don't get that far, an error is thrown during deserilization.
Stack trace snippet:
java.io.IOException: Could not extract class from input message
at de.fraunhofer.iais.eis.ids.jsonld.Parser.parseMessage(Parser.java:947) ~[infomodel-serializer-4.0.8.jar:?]
at de.fraunhofer.iais.eis.ids.jsonld.Parser.parseMessage(Parser.java:995) ~[infomodel-serializer-4.0.8.jar:?]
at de.fraunhofer.iais.eis.ids.jsonld.Serializer.deserialize(Serializer.java:119) ~[infomodel-serializer-4.0.8.jar:?]
at io.dataspaceconnector.controller.ExampleController.getConnectorConfiguration(ExampleController.java:136) ~[classes/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.7.jar:5.3.7]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.7.jar:5.3.7]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.7.jar:5.3.7]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.7.jar:5.3.7]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.7.jar:5.3.7]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.7.jar:5.3.7]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1063) ~[spring-webmvc-5.3.7.jar:5.3.7]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.7.jar:5.3.7]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.7.jar:5.3.7]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.7.jar:5.3.7]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.46.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.7.jar:5.3.7]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.46.jar:4.0.FR]
3. Rule: missing attributes
IDS object (as RDF):
{
"@type": "ids:Permission",
"@id": "https://w3id.org/idsa/autogen/permission/885c4512-8031-42d3-a9c0-d50594dad37f",
"ids:description": [
{
"@value": "provide-access",
"@type": "http://www.w3.org/2001/XMLSchema#string"
}
],
"ids:title": [
{
"@value": "Allow Data Usage",
"@type": "http://www.w3.org/2001/XMLSchema#string"
}
],
"ids:action": [
{
"@id": "https://w3id.org/idsa/code/USE"
}
]
}
and/or
{
"@type": "ids:Permission",
"@id": "https://w3id.org/idsa/autogen/permission/770f890f-9ea1-4cd6-9f87-8d8d3f126188",
"ids:description": [
{
"@value": "provide-access",
"@type": "http://www.w3.org/2001/XMLSchema#string"
}
],
"ids:title": [
{
"@value": "Allow Data Usage",
"@type": "http://www.w3.org/2001/XMLSchema#string"
}
],
"ids:action": [
{
"@id": "idsc:USE"
}
]
}
IDS object after deserialization (from IntelliJ debug console):
Can you help us with this problem? @maboeckmann @sebbader