Description of problem: When accessing a Task Content, the contentMap is null; How reproducible: Always. Steps to Reproduce: Basically you can follow the steps from this article: https://access.redhat.com/solutions/887653 You need to access an User task content using the URL: /task/{taskId}/content/ Actual results: Content Map is missing: {"id":1,"serializedContent":"SERIALIZED CONTENT"} Expected results: It should come with values, for example: {"id":1,"serializedContent":null,"contentMap":{"GroupId":"adm","NodeName":"Aprovar!"},"content":"SERIALIZED CONTENT"}
This is primarily a doc fix.
Marco, could you clarify? What is the way to get the content of a task through the remote API correctly?
Fixed (with caveat, see below). Commits: 6.2.x: https://github.com/droolsjbpm/jbpm/commit/8922b2bc master: https://github.com/droolsjbpm/jbpm/commit/a324d8f4 -- Caveat: The operation shown above is the correct way to get the task content. The reporter (and many others) are mistakenly assuming that the task content is always a map, which is it is often, but not always: task content can sometimes simply be a different object as a map. The REST operation (or any other operation!) can't "know" what sort of content the user has decided to associate with the task -- that kind of information would have to be added with a new feature (and a thorough refactoring of how we now associate information with tasks!). However, I can understand the mistake: the documentation does not explain this, not to mention that the task content API is neither clear nor easy-to-use. The documentation for this has to be improved. The fix here was that I had created a 'contentMap' field, but that I was never filling it: William, thank you for catching this!
Hi Marco and William, I am not sure what is wrong in this BZ because we have the task content REST operation covered since BZ 1057749 and the tests passed in the last recent builds too (we check that the contentMap contains the fields), hence I cannot use them to verify this issue. Is it any specific content that was not filled?
Hi Ivo, The only specific issue here is that the contentMap field in the org.kie.remote.jaxb.gen.Content instance returned to the client was not being filled when the content was a map. Does that make sense?
Oh, map in a map, I see :) ... thank you Marco
Verification failed in BPMS 6.1.0.ER5 I noticed that I had an unintentional workaround: [X] Map<String, Object> ret = content.getContentMap(); if (ret == null) { ret = (Map<String, Object>) ContentMarshallerHelper.unmarshall(content.getSerializedContent(), null); } However, when I remove it so it uses just the line [X], the map is null: Notice that the returned content is still without the contentMap element: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><content><id>14</id><content>rO0ABXoAAAF4CgYIBhACGABKlwIIABJIb3JnLmRyb29scy5jb3JlLm1hcnNoYWxsaW5nLmltcGwuU2VyaWFsaXphYmxlUGxhY2Vob2xkZXJSZXNvbHZlclN0cmF0ZWd5GsgBrO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAAEdwQAAAAEdAAEaWJla3QADE15T2JqZWN0VGFza3QADk15IE9iamVjdCBUYXNrc3IAKW9yZy5qYm9zcy5xYS5icG1zLmpicG0uaW50ZWdyYXRpb24uTXlUeXBlAAAAAAAAAAECAAFMAAR0ZXh0dAASTGphdmEvbGFuZy9TdHJpbmc7eHB0AA5teSBvYmplY3QgdGV4dHhSVAoRCgdBY3RvcklkEAAaBAAAAAAKEgoIVGFza05hbWUQABoEAAAAAQoSCghOb2RlTmFtZRAAGgQAAAACChcKDWlucHV0TXlPYmplY3QQABoEAAAAAw==</content></content>
Note to myself: since there is a workaround, engineering is currently recommending this *not* be a blocker.
As much as I could test this works properly. When issuing GET request for this endpoint:http://localhost:8080/kie-wb/rest/task/2/content I received following response content: <content> <id>2</id> <content>rO0ABXoAAAFyCgYIBxAAGABK8AEIABJIb3JnLmRyb29scy5jb3JlLm1hcnNoYWxsaW5nLmltcGwuU2VyaWFsaXphYmxlUGxhY2Vob2xkZXJSZXNvbHZlclN0cmF0ZWd5GqEBrO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAAGdwQAAAAGdAAiUGxlYXNlIHBlcmZvcm0gYSBzZWxmLWV2YWx1dGF0aW9uLnQABHRlc3R0ABVQZXJmb3JtYW5jZUV2YWx1YXRpb250AA9TZWxmIEV2YWx1YXRpb250AAVmYWxzZXQABm1hY2lla3hSdQoRCgdDb21tZW50EAAaBAAAAAAKEAoGcmVhc29uEAAaBAAAAAEKEgoIVGFza05hbWUQABoEAAAAAgoSCghOb2RlTmFtZRAAGgQAAAADChMKCVNraXBwYWJsZRAAGgQAAAAEChEKB0FjdG9ySWQQABoEAAAABQ==</content> <contentMap> <entry key="Comment" class-name="java.lang.String">rO0ABXQAIlBsZWFzZSBwZXJmb3JtIGEgc2VsZi1ldmFsdXRhdGlvbi4=</entry> <entry key="reason" class-name="java.lang.String">rO0ABXQABHRlc3Q=</entry> <entry key="TaskName" class-name="java.lang.String">rO0ABXQAFVBlcmZvcm1hbmNlRXZhbHVhdGlvbg==</entry> <entry key="NodeName" class-name="java.lang.String">rO0ABXQAD1NlbGYgRXZhbHVhdGlvbg==</entry> <entry key="Skippable" class-name="java.lang.String">rO0ABXQABWZhbHNl</entry> <entry key="ActorId" class-name="java.lang.String">rO0ABXQABm1hY2llaw==</entry></contentMap> </content> as you can see the contentMap is filled in. It still has serialized value but this is intended as the marshaling framework uses StringKeyObjectValueMapXmlAdapter that is responsible for round tripping of the values. @Ivo, would it be possible to test this on latest build with your test cases?
Maciej, it works unless you use an object of your own type. In that case you get ClassNotFoundException and a response without contentMap: <content> <id>9</id> <content>rO0ABXoAAAF4CgYIBhAEGABKlwIIABJIb3JnLmRyb29scy5jb3JlLm1hcnNoYWxsaW5nLmltcGwuU2VyaWFsaXphYmxlUGxhY2Vob2xkZXJSZXNvbHZlclN0cmF0ZWd5GsgBrO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAAEdwQAAAAEc3IAKW9yZy5qYm9zcy5xYS5icG1zLmpicG0uaW50ZWdyYXRpb24uTXlUeXBlAAAAAAAAAAECAAFMAAR0ZXh0dAASTGphdmEvbGFuZy9TdHJpbmc7eHB0AA5teSBvYmplY3QgdGV4dHQABGliZWt0AAxNeU9iamVjdFRhc2t0AA5NeSBPYmplY3QgVGFza3hSVAoXCg1pbnB1dE15T2JqZWN0EAAaBAAAAAAKEQoHQWN0b3JJZBAAGgQAAAABChIKCFRhc2tOYW1lEAAaBAAAAAIKEgoITm9kZU5hbWUQABoEAAAAAw==</content> </content> It seems that there is some problem with class loading. Because the class is present on both server and client side and is used in other tests without any problems.
Created attachment 1137058 [details] ClassNotFoundException