Bug 1312887

Summary: kie-server JSON doesn't work with singleton extra classes
Product: [Retired] JBoss BRMS Platform 6 Reporter: Tomas Schlosser <tschloss>
Component: Kie-ServerAssignee: Edson Tirelli <etirelli>
Status: CLOSED EOL QA Contact: Karel Suta <ksuta>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 6.2.0   
Target Milestone: ER1   
Target Release: 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 20:04:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Schlosser 2016-02-29 12:52:03 UTC
Description of problem:
Using a code like this:
KieServicesConfiguration config = createJmsConfiguration();
config.setMarshallingFormat(MarshallingFormat.JSON);
config.setExtraJaxbClasses(Collections.singleton(clazz));
...
RuleServicesClient rules;
...
rules.executeCommands("testContainer", commands.newBatchExecution(commandList));

Throws unsupported operation exception:
java.lang.UnsupportedOperationException: null
	at java.util.AbstractCollection.add(AbstractCollection.java:262)
	at org.kie.server.api.marshalling.json.JSONMarshaller.<init>(JSONMarshaller.java:69)
	at org.kie.server.api.marshalling.MarshallerFactory.getMarshaller(MarshallerFactory.java:41)
	at org.kie.server.client.impl.AbstractKieServicesClientImpl.<init>(AbstractKieServicesClientImpl.java:72)
	at org.kie.server.client.impl.KieServicesClientImpl.<init>(KieServicesClientImpl.java:60)
	at org.kie.server.client.KieServicesFactory.newKieServicesClient(KieServicesFactory.java:93)
	at com.redhat.xpaas.brms.transport.TransportTest.evaluateRules(TransportTest.java:249)
	at com.redhat.xpaas.brms.transport.TransportTest.testRestJson(TransportTest.java:144)


Version-Release number of selected component (if applicable):
kie-server-api 6.3.0.Final.redhat-1

How reproducible:
Always

Additional info:
The problem is in JSONMarshaller:69 when the passed set is singleton/unmodifiable instance.

Comment 5 Karel Suta 2016-03-21 11:38:39 UTC
Verified in 6.3.0 ER1