Troubleshooting
Problem
The Eclipse Modeling Framework (EMF) API XMLLoadImpl.handleErrors throws the IllegalValueException exception when the
Symptom
Following is the exception text from the log file:
Caused by: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value 'null' is not legal. (C:/PMRWorkSpace/PMR_test/BOTestValidations/, 31, 106)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:80)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:189)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:179)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1094)
at com.ibm.ws.bo.bomodel.util.SerializerUtil$2.run(SerializerUtil.java:171)
at java.security.AccessController.doPrivileged(AccessController.java:246)
at com.ibm.ws.bo.bomodel.util.SerializerUtil.privilegedLoad(SerializerUtil.java:162)
at com.ibm.ws.bo.service.BOXMLSerializerImpl.load(BOXMLSerializerImpl.java:248)
Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'null' is not legal. (C:/PMRWorkSpace/PMR_test/BOTestValidations/, 31, 106)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2402)
at com.ibm.ws.bo.bomodel.util.BOXMLHandler.setFeatureValue(BOXMLHandler.java:773)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2387)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHandler.java:1775)
at com.ibm.ws.bo.bomodel.util.BOXMLHandler.handleFeature(BOXMLHandler.java:501)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:633)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:179)
... 9 more
Caused by: java.lang.IllegalArgumentException: The 'no null' constraint is violated
at org.eclipse.emf.common.util.BasicEList.validate(BasicEList.java:172)
at org.eclipse.emf.ecore.util.EcoreEList.validate(EcoreEList.java:59)
at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList.java:619)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddUnique(NotifyingListImpl.java:323)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:307)
at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHelperImpl.java:1061)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2397)
... 27 more
An array reference that is declared with minOccurs and maxOccurs is defined before a nillable=true element in the XSD document.
For example, the <xsd:element ref="u:PersonMiddleName" minOccurs="0" maxOccurs="unbounded"/> element is defined before the <xsd:element name="PersonMiddleName" nillable="true" type="u:PersonNameTextType"/> element in the XSD document.
Resolving The Problem
To work around the problem, use one of the following options:
- To keep <ns1:PersonMiddleName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" /> in the XML document, modify the XSD as follows: <xsd:element ref="u:PersonMiddleName" nillable="true"/> instead of <xsd:element ref="u:PersonMiddleName" minOccurs="0" maxOccurs="unbounded"/>.
- To keep <xsd:element ref="u:PersonMiddleName" minOccurs="0" maxOccurs="unbounded"/> in the XSD document, modify the XML document as follows: Change <ns1:PersonMiddleName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" /> to <ns1:PersonMiddleName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />.
Note: xsi:nil="true" in the XML document is valid only when the corresponding XSD document defines nillable="true".
Was this topic helpful?
Document Information
Modified date:
23 June 2018
UID
swg21408248