Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » XSDConcreteComponentImpl.forceReplace throws NPE
XSDConcreteComponentImpl.forceReplace throws NPE [message #597272] Wed, 30 November 2005 13:16
Marcin Maciukiewicz is currently offline Marcin MaciukiewiczFriend
Messages: 5
Registered: July 2009
Junior Member
Hello everyone!

Problem occurs when I call:

org.eclipse.xsd.XSDSchema xmlSchema=...;
org.eclipse.emf.ecore.util.EcoreUtil.copy(xmlSchema);

I get NPE:
java.lang.NullPointerException
at
org.eclipse.xsd.impl.XSDConcreteComponentImpl.forceReplace(X SDConcreteComponentImpl.java:1679)
at
org.eclipse.xsd.impl.XSDModelGroupImpl.changeAttribute(XSDMo delGroupImpl.java:678)
at
org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(XSDCon creteComponentImpl.java:1219)
at
org.eclipse.xsd.impl.XSDModelGroupImpl.setCompositor(XSDMode lGroupImpl.java:195)
at org.eclipse.xsd.impl.XSDModelGroupImpl.eSet(XSDModelGroupImp l.java:346)
..... more

what I see in XSDConcreteComponentImpl.forceReplace is:
1675: isReconciling = true;
1676: updatingDOM = true;
1677:
1678: XSDConcreteComponentImpl container =
(XSDConcreteComponentImpl)getContainer();
1679: container.isReconciling = true;
1680: container.updatingDOM = true;

let's see what is in called method:
public XSDConcreteComponent getContainer()
{
return
eContainer() instanceof XSDConcreteComponent ?
(XSDConcreteComponent)eContainer() :
null;
}

For me there is a bug. Since getContainer() can return null,
forceReplace have to care about container==null condition.

EcoreUtil develops copy in two steps:
1) copy of structure
2) copy of references

Because of explained above first step fails with NPE because
XSDConcreteComponentImpl don't have assigned eContainer at this stage.

What you think about that? Do you have any ideas how to create copy of
XSDSchema object? (this is must be requirement, I cannot create it from
disk file)
Previous Topic:Problems with deriving types
Next Topic:XSDConcreteComponentImpl.forceReplace throws NPE
Goto Forum:
  


Current Time: Fri Dec 19 18:22:23 GMT 2014

Powered by FUDForum. Page generated in 0.01559 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software