Update of /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/cimxml/sax/node
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2259/src/org/sblim/cimclient/internal/cimxml/sax/node
Modified Files:
Tag: Experimental
InstanceNameNode.java
Log Message:
2707 INSTANCENAME ignores KEYVALUE and VALUE.REFERENCE children
Index: InstanceNameNode.java
===================================================================
RCS file: /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/cimxml/sax/node/InstanceNameNode.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -d -r1.1.2.9 -r1.1.2.10
--- InstanceNameNode.java 1 Jun 2009 17:01:10 -0000 1.1.2.9
+++ InstanceNameNode.java 12 Nov 2013 16:32:20 -0000 1.1.2.10
@@ -18,8 +18,9 @@
* 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser
* 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL
* 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1)
- * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2)
+ * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2)
* 2797550 2009-06-01 raman_arora JSR48 compliance - add Java Generics
+ * 2707 2013-11-12 blaschke-oss INSTANCENAME ignores KEYVALUE and VALUE.REFERENCE children
*/
package org.sblim.cimclient.internal.cimxml.sax.node;
@@ -50,6 +51,8 @@
private CIMObjectPath iLocalPath;
+ private String iNodeName;
+
/**
* Ctor.
*/
@@ -62,6 +65,7 @@
this.iLocalPath = pSession.getDefLocalPath();
if (this.iCIMPropAL != null) this.iCIMPropAL.clear();
this.iClassName = getClassName(pAttribs);
+ this.iNodeName = null;
}
/**
@@ -72,17 +76,33 @@
// no data
}
+ private static final String[] ALLOWED_CHILDREN = { KEYBINDING, KEYVALUE, VALUE_REFERENCE };
+
@Override
public void testChild(String pNodeNameEnum) throws SAXException {
- if (pNodeNameEnum != KEYBINDING) throw new SAXException(getNodeName()
- + " node can only have KEYBINDING child nodes! " + pNodeNameEnum
- + " child node is not allowed!");
+ for (int i = 0; i < ALLOWED_CHILDREN.length; i++)
+ if (ALLOWED_CHILDREN[i] == pNodeNameEnum) {
+ if (this.iNodeName != null && this.iNodeName != pNodeNameEnum) throw new SAXException(
+ getNodeName() + " node cannot have " + pNodeNameEnum
+ + " child node, it already has a " + this.iNodeName + "!");
+ if (pNodeNameEnum != KEYBINDING) {
+ if (this.iNodeName != null) throw new SAXException(getNodeName()
+ + " node can have only one " + pNodeNameEnum + " child node!");
+ }
+ this.iNodeName = pNodeNameEnum;
+ return;
+ }
+ throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum
+ + " child node!");
}
@Override
public void childParsed(Node pChild) {
if (this.iCIMPropAL == null) this.iCIMPropAL = new ArrayList<CIMProperty<?>>();
- this.iCIMPropAL.add(((KeyBindingNode) pChild).getCIMProperty());
+ if (pChild instanceof KeyBindingNode) this.iCIMPropAL.add(((KeyBindingNode) pChild)
+ .getCIMProperty());
+ else this.iCIMPropAL.add(new CIMProperty<Object>("", ((AbstractScalarValueNode) pChild)
+ .getType(), ((AbstractScalarValueNode) pChild).getValue(), true, false, null));
}
@Override
|