| Trouble with ReconciliationHelper [message #10339] | 
Wed, 05 March 2008 14:37  | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: hanyu.xiao.gmail.com 
 
Hi, 
 
Could someone tell me how to make the following snippet work? 
 
       Process bpelProcess = BPELFactory.eINSTANCE.createProcess(); 
       Variables variables = BPELFactory.eINSTANCE.createVariables(); 
 
       Variable variable = BPELFactory.eINSTANCE.createVariable(); 
       variable.setName("foo"); 
       XSDSimpleTypeDefinition type =  
XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition(); 
       type.setName("xsd:string"); 
       variable.setType(type); 
 
       variables.getChildren().add(variable); 
       bpelProcess.setVariables(variables); 
 
When executing to the second line from the bottom, I’d get this exception: 
 
Exception in thread "main" java.lang.NullPointerException 
 
       at  
 org.eclipse.bpel.model.util.ReconciliationHelper.patchParent Element(ReconciliationHelper.java:481) 
       at  
 org.eclipse.bpel.model.impl.VariablesImpl.adoptContent(Varia blesImpl.java:176) 
       at  
 org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl.eNotify(W SDLElementImpl.java:392) 
       at  
 org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(E coreEList.java:249) 
       at  
 org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:300) 
       at  org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 26) 
 
It seems that ReconciliationHelper assumes that "variables" has a  
container, which won’t be true until the last line is called. But if I  
move the last line to the third, like this: 
 
       Process bpelProcess = BPELFactory.eINSTANCE.createProcess(); 
       Variables variables = BPELFactory.eINSTANCE.createVariables(); 
       bpelProcess.setVariables(variables); 
 
       Variable variable = BPELFactory.eINSTANCE.createVariable(); 
       variable.setName("foo"); 
       XSDSimpleTypeDefinition type =  
XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition(); 
       type.setName("xsd:string"); 
       variable.setType(type); 
 
       variables.getChildren().add(variable); 
 
ReconciliationHelper will throw another exception: 
 
Exception in thread "main" java.lang.NullPointerException 
       at  
 org.eclipse.bpel.model.util.ReconciliationHelper.getBPELChil dElementByLocalName(ReconciliationHelper.java:506) 
       at  
 org.eclipse.bpel.model.util.ReconciliationHelper.patchParent Element(ReconciliationHelper.java:481) 
       at  
 org.eclipse.bpel.model.impl.VariablesImpl.adoptContent(Varia blesImpl.java:176) 
       at  
 org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl.eNotify(W SDLElementImpl.java:392) 
       at  
 org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(E coreEList.java:249) 
       at  
 org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:300) 
       at  org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 26) 
 
This time ReconciliationHelper assumed that the BPEL model has an  
associated XML element, which is again not correct in this case. 
 
Maybe I’m just not using the BPEL models correctly, but this code used  
to work with the M2 build. What would I need to do to fix this in M3? 
 
Thanks in advance, 
Hanyu
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.02948 seconds