Update of /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/cimxml
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7644/src/org/sblim/cimclient/internal/cimxml
Modified Files:
CIMXMLParserImpl.java
Log Message:
2678 parseMULTI___ allows one SIMPLE___ child element
Index: CIMXMLParserImpl.java
===================================================================
RCS file: /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- CIMXMLParserImpl.java 11 Oct 2013 10:34:21 -0000 1.59
+++ CIMXMLParserImpl.java 29 Oct 2013 11:21:07 -0000 1.60
@@ -66,6 +66,7 @@
* 2671 2013-09-25 blaschke-oss Potential null pointer exception in parseERROR
* 2675 2013-09-27 blaschke-oss CIMXMLParseException messages should contain element name
* 2676 2013-09-27 blaschke-oss parseMULTI(EXP)REQ looking for wrong child elements
+ * 2678 2013-09-30 blaschke-oss parseMULTI___ allows one SIMPLE___ child element
*/
package org.sblim.cimclient.internal.cimxml;
@@ -2192,6 +2193,13 @@
return response;
}
// MULTIEXPRSP
+ Element multiexprspE = (Element) searchFirstNode(pMessageE, "MULTIEXPRSP");
+ if (multiexprspE != null) {
+ CIMResponse response = parseMULTIEXPRSP(multiexprspE);
+ response.setMethod("MULTIEXPRSP");
+ response.setId(id);
+ return response;
+ }
// SIMPLEREQ
Element simplereqE = (Element) searchFirstNode(pMessageE, "SIMPLEREQ");
@@ -2354,6 +2362,8 @@
Element[] multiRespElementA = searchNodes(pSimpleRspE, "SIMPLERSP");
if (multiRespElementA != null && multiRespElementA.length > 0) {
+ if (multiRespElementA.length < 2) throw new CIMXMLParseException(
+ "MULTIRSP element must have at least two SIMPLERSP child elements!");
CIMResponse multiRsp = new CIMResponse();
for (int i = 0; i < multiRespElementA.length; i++) {
Element methodresponseE = multiRespElementA[i];
@@ -2400,6 +2410,8 @@
Element[] methodReqElementA = searchNodes(pMultiReqE, "SIMPLEREQ");
if (methodReqElementA != null && methodReqElementA.length > 0) {
+ if (methodReqElementA.length < 2) throw new CIMXMLParseException(
+ "MULTIREQ element must have at least two SIMPLEREQ child elements!");
CIMRequest multiReq = new CIMRequest();
for (int i = 0; i < methodReqElementA.length; i++) {
Element methodrequestE = methodReqElementA[i];
@@ -2554,6 +2566,8 @@
Element[] methodReqElementA = searchNodes(pMultiExpReqE, "SIMPLEEXPREQ");
if (methodReqElementA != null && methodReqElementA.length > 0) {
+ if (methodReqElementA.length < 2) throw new CIMXMLParseException(
+ "MULTIEXPREQ element must have at least two SIMPLEEXPREQ child elements!");
CIMRequest multiReq = new CIMRequest();
for (int i = 0; i < methodReqElementA.length; i++) {
Element methodrequestE = methodReqElementA[i];
@@ -3206,6 +3220,33 @@
}
/**
+ * parseMULTIEXPRSP
+ *
+ * @param pMultiExpRspE
+ * @return CIMResponse
+ * @throws CIMXMLParseException
+ */
+ public static CIMResponse parseMULTIEXPRSP(Element pMultiExpRspE) throws CIMXMLParseException {
+ // <!ELEMENT MULTIEXPRSP (SIMPLEEXPRSP,SIMPLEEXPRSP+)>
+
+ Element[] multiExpRespElementA = searchNodes(pMultiExpRspE, "SIMPLEEXPRSP");
+ if (multiExpRespElementA != null && multiExpRespElementA.length > 0) {
+ if (multiExpRespElementA.length < 2) throw new CIMXMLParseException(
+ "MULTIEXPRSP element must have at least two SIMPLEEXPRSP child elements!");
+ CIMResponse multiExpRsp = new CIMResponse();
+ for (int i = 0; i < multiExpRespElementA.length; i++) {
+ Element methodresponseE = multiExpRespElementA[i];
+ CIMResponse rsp = parseSIMPLEEXPRSP(methodresponseE);
+ rsp.setMethod("SIMPLEEXPRSP");
+ multiExpRsp.addResponse(rsp);
+ }
+ return multiExpRsp;
+ }
+
+ throw new CIMXMLParseException("MULTIEXPRSP element missing SIMPLEEXPRSP child element!");
+ }
+
+ /**
* parseEXPMETHODRESPONSE
*
* @param pExpMethodResponseE
|