JBoss Community

Re: XML Deserialization of Result Map Fails 5.4.0.Beta1

created by Timothy Charman in jBPM - View the full discussion

OK, so Strings - 2 separate things we observe.

 

1. Using the eclipse editor, if I define the workflow variable as a String, then save, close the workflow and edit the variable, it shows up as Object of class String, i.e. is not consistent.  I guess this is because in both cases it writes a structureRef="String"

2. This code in WorkItemNodeInstance method triggerCompleted:

 

                        Object value = workItem.getResult(association.getSources().get(0));

                        if (value == null) {

                            try {

                                value = MVEL.eval(association.getSources().get(0), new WorkItemResolverFactory(workItem));

                            } catch (Throwable t) {

                                // do nothing

                            }

                        }

                        Variable varDef = variableScopeInstance.getVariableScope().findVariable(association.getTarget());

                        DataType dataType = varDef.getType();

                        // exclude java.lang.Object as it is considered unknown type

                        if (!dataType.getStringType().endsWith("java.lang.Object") && value instanceof String) {

                            value = dataType.readValue((String) value);

                        }

                        variableScopeInstance.setVariable(association.getTarget(), value);


For my String structureRef variables, I see my XStream exception, so I know it is hitting:

                            value = dataType.readValue((String) value);


So how am I meant to use a String that doesn't have XML in it...just a plain string that I want to pass back to the workflow?  The if statement:

                        if (!dataType.getStringType().endsWith("java.lang.Object") && value instanceof String) {


says to execute this XStream method if the type is not defined as java.lang.Object (which it isn't, it is defined as structureRef String) and the value is an instance of String, which it is, I'm trying to pass a string back.

 

To me this appears like the code doesn't cater for handling strings that are not representing serialized content...it appears that if we set the structureRef to java.lang.Object then this will work, but I suspect we won't be able to use the workflow variables in script tasks without casting back to String.

 

Thanks for all your help.

 

Tim

Reply to this message by going to Community

Start a new discussion in jBPM at Community