Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[emf-dev] Cannot set content of particle

Hi,

 

I am using the eclipse XSD API to rewrite schemas. I am trying to add particles to a model group. The added particles should be based on an existing particle in the model group, but with a different element content. Hence, I clone a particle, using particle.cloneConcreteComponent(true, true). I set an existing element as the content of this particle. However, when I do this, I get the following exception:

 

java.lang.NullPointerException

      at org.eclipse.xsd.impl.XSDConcreteComponentImpl.forceNiceRemoveChild(XSDConcreteComponentImpl.java:1696)

      at org.eclipse.xsd.impl.XSDConcreteComponentImpl.niceRemoveChild(XSDConcreteComponentImpl.java:1609)

      at org.eclipse.xsd.impl.XSDConcreteComponentImpl.orphanContent(XSDConcreteComponentImpl.java:1449)

      at org.eclipse.xsd.impl.XSDParticleImpl.orphanContent(XSDParticleImpl.java:715)

      at org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(XSDConcreteComponentImpl.java:1199)

      at org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch(NotificationImpl.java:1030)

      at org.eclipse.xsd.impl.XSDParticleImpl.setContent(XSDParticleImpl.java:324)

      at com.galdosinc.smt.rewriter.SchemaRewriter.processModelGroup(SchemaRewriter.java:462)

      at com.galdosinc.smt.rewriter.SchemaRewriter.processElementGroup(SchemaRewriter.java:586)

      at com.galdosinc.smt.rewriter.SchemaRewriter.processElementGroupList(SchemaRewriter.java:411)

      at com.galdosinc.smt.rewriter.SchemaRewriter.processSchema(SchemaRewriter.java:275)

      at com.galdosinc.smt.rewriter.SchemaRewriter.rewriteSchema(SchemaRewriter.java:202)

      at com.galdosinc.smt.rewriter.SchemaRewriter.main(SchemaRewriter.java:104)

 

 

The following is an example of my code:

 

XSDParticle particleClone = (XSDParticle)particle.cloneConcreteComponent(true, true);

particleClone.setContent(modelGrpSubstitutableElement); //This is where the error occurs

 

Am I using the cloneConcreteComponent method correctly. Is there something else I need to call after particle.setContent?

 

Any help is greatly appreciated!

 

Thanks,

Michael

 


Back to the top