[COMPARE / TENEO] how can I apply a diff to an existing EObject without the NPE? [message #610253] |
Wed, 07 November 2007 01:10 |
Jason Henriksen Messages: 231 Registered: July 2009 |
Senior Member |
|
|
Hi All,
I'm getting this exception running EMF Compare in a
WebSphere SOAP service. I can't just call save on the XML backed object
because that will cause Hibernate to do an insert instead of an update.
================================
Caused by: java.lang.Throwable: java.lang.NullPointerException
at
org.eclipse.emf.compare.diff.service.DiffService.parseExtens ionMetadata(DiffService.java:195)
at
org.eclipse.emf.compare.diff.service.DiffService.<clinit>(DiffService.java:54)
at
java.lang.J9VMInternals.initializeImpl(Native Method)
================================
I've gotten one EObject graph out of Teneo and the other from
deserializing a SOAP request. Here's the code:
=================================
//--- get an updated EObject from XML
consumerUpdateInput =
(ConsumerUpdateRequest)soapUtil.
getObjectFromSoap(consumerUpdateRequest);
consumerXML = consumerUpdateInput.getConsumer();
//--- get the real one from the DB
int consumerKey = consumerXML.getConsumerSK();
consumerSQL = (Consumer)session.load("Consumer",
new Integer(consumerKey));
//--- apply the changes to the DB backed object.
Resource leftRes = new XMLResourceImpl();
leftRes.setURI(URI.createURI("leftRes.xml"));
leftRes.getContents().add((EObject)consumerSQL);
Resource rightRes = new XMLResourceImpl();
rightRes.setURI(URI.createURI("rightRes.xml"));
rightRes.getContents().add((EObject)consumerXML);
//!!! This line throws the exception
final MatchModel match = new DifferencesServices().modelMatch(
(EObject)consumerSQL,
(EObject)consumerXML,
new NullProgressMonitor(),
Collections.<String, Object> emptyMap());
final DiffModel diff = new DiffMaker().doDiff(match);
EList<DiffElement> e = diff.getOwnedElements();
ListIterator li = e.listIterator();
while(li.hasNext()){
DiffElement element = (DiffElement)li.next();
AbstractMerger merger = MergeFactory.createMerger(element);
merger.applyInOrigin();
}
//--- save the updated consumer.
session.save(consumerSQL);
session.getTransaction().commit();
resultMessage.setCode("SUCCESS");
==============================
Any help is very much appreciated,
Jason Henriksen
|
|
|
Powered by
FUDForum. Page generated in 0.03178 seconds