From: Dave B. <bla...@us...> - 2013-09-27 18:32:22
|
Update of /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/cimxml In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20334/src/org/sblim/cimclient/internal/cimxml Modified Files: Tag: Experimental CIMXMLParserImpl.java Log Message: 2675 CIMXMLParseException messages should contain element name Index: CIMXMLParserImpl.java =================================================================== RCS file: /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java,v retrieving revision 1.14.2.47 retrieving revision 1.14.2.48 diff -u -d -r1.14.2.47 -r1.14.2.48 --- CIMXMLParserImpl.java 25 Sep 2013 18:14:42 -0000 1.14.2.47 +++ CIMXMLParserImpl.java 27 Sep 2013 18:32:19 -0000 1.14.2.48 @@ -64,6 +64,7 @@ * 2669 2013-09-24 blaschke-oss Potential null pointer exception in parseMESSAGE * 2670 2013-09-25 blaschke-oss NAME attribute not required by DOM parser * 2671 2013-09-25 blaschke-oss Potential null pointer exception in parseERROR + * 2675 2013-09-27 blaschke-oss CIMXMLParseException messages should contain element name */ package org.sblim.cimclient.internal.cimxml; @@ -154,12 +155,12 @@ // <!ATTLIST CIM %CIMVERSION;%DTDVERSION;> Attr cim_cimversionA = (Attr) searchAttribute(pCimE, "CIMVERSION"); if (cim_cimversionA == null) throw new CIMXMLParseException( - "CIMVERSION attribute not found!"); + "CIM element missing CIMVERSION attribute!"); String cimversion = cim_cimversionA.getNodeValue(); Attr cim_dtdversionA = (Attr) searchAttribute(pCimE, "DTDVERSION"); if (cim_dtdversionA == null) throw new CIMXMLParseException( - "DTDVERSION attribute not found!"); + "CIM element missing DTDVERSION attribute!"); String dtdversion = cim_dtdversionA.getNodeValue(); // MESSAGE @@ -171,9 +172,11 @@ return message; } - // TODO : DECLARATION + // DECLARATION + if (searchFirstNode(pCimE, "DECLARATION") != null) throw new CIMXMLParseException( + "DECLARATION element not supported!"); - throw new CIMXMLParseException(); + throw new CIMXMLParseException("CIM element missing required child element!"); } // //////////////////////////////////////////////////////////////////////////////////////// @@ -296,7 +299,7 @@ return op; } - throw new CIMXMLParseException(); + throw new CIMXMLParseException("VALUE.REFERENCE element missing required child element!"); } /** @@ -345,7 +348,7 @@ return obj; } - throw new CIMXMLParseException(); + throw new CIMXMLParseException("VALUE.OBJECT element missing required child element!"); } /** @@ -361,12 +364,14 @@ // INSTANCENAME Element instancenameE = (Element) searchFirstNode(pValueNamedInstanceE, "INSTANCENAME"); - if (instancenameE == null) { throw new CIMXMLParseException(); } + if (instancenameE == null) { throw new CIMXMLParseException( + "VALUE.NAMEDINSTANCE element missing INSTANCENAME child element!"); } CIMObjectPath op = parseINSTANCENAME(instancenameE); // INSTANCE Element instanceE = (Element) searchFirstNode(pValueNamedInstanceE, "INSTANCE"); - if (instanceE == null) { throw new CIMXMLParseException(); } + if (instanceE == null) { throw new CIMXMLParseException( + "VALUE.NAMEDINSTANCE element missing INSTANCE child element!"); } CIMInstance inst = parseINSTANCE(instanceE, op); // BB mod return inst; } @@ -384,12 +389,14 @@ // INSTANCEPATH Element instancepathE = (Element) searchFirstNode(pValueNamedInstanceE, "INSTANCEPATH"); - if (instancepathE == null) { throw new CIMXMLParseException(); } + if (instancepathE == null) { throw new CIMXMLParseException( + "VALUE.INSTANCEWITHPATH element missing INSTANCEPATH child element!"); } CIMObjectPath op = parseINSTANCEPATH(instancepathE); // INSTANCE Element instanceE = (Element) searchFirstNode(pValueNamedInstanceE, "INSTANCE"); - if (instanceE == null) { throw new CIMXMLParseException(); } + if (instanceE == null) { throw new CIMXMLParseException( + "VALUE.INSTANCEWITHPATH element missing INSTANCE child element!"); } CIMInstance inst = parseINSTANCE(instanceE, op); // BB mod return inst; } @@ -419,12 +426,13 @@ // INSTANCE Element instanceE = (Element) searchFirstNode(pValueNamedObjectE, "INSTANCE"); - if (instanceE == null) { throw new CIMXMLParseException(); } + if (instanceE == null) { throw new CIMXMLParseException( + "VALUE.NAMEDOBJECT element missing INSTANCE child element!"); } CIMInstance inst = parseINSTANCE(instanceE, op); // BB mod return inst; } - throw new CIMXMLParseException(); + throw new CIMXMLParseException("VALUE.NAMEDOBJECT element missing required child element!"); } /** @@ -446,7 +454,8 @@ // CLASS Element classE = (Element) searchFirstNode(pValueObjectWithPathE, "CLASS"); - if (classE == null) { throw new CIMXMLParseException(); } + if (classE == null) { throw new CIMXMLParseException( + "VALUE.OBJECTWITHPATH element missing CLASS child element!"); } // TODO parse CLASS with ObjectPath CIMClass obj = parseCLASS(classE); return obj; @@ -459,12 +468,14 @@ // INSTANCE Element instanceE = (Element) searchFirstNode(pValueObjectWithPathE, "INSTANCE"); - if (instanceE == null) { throw new CIMXMLParseException(); } + if (instanceE == null) { throw new CIMXMLParseException( + "VALUE.OBJECTWITHPATH element missing INSTANCE child element!"); } CIMInstance inst = parseINSTANCE(instanceE, op); // BB mod return inst; } - throw new CIMXMLParseException(); + throw new CIMXMLParseException( + "VALUE.OBJECTWITHPATH element missing required child element!"); } /** @@ -487,7 +498,8 @@ // CLASS Element classE = (Element) searchFirstNode(pValueObjectWithLocalPathE, "CLASS"); - if (classE == null) { throw new CIMXMLParseException(); } + if (classE == null) { throw new CIMXMLParseException( + "VALUE.OBJECTWITHLOCALPATH element missing CLASS child element!"); } // TODO parse class with path CIMClass obj = parseCLASS(classE); return obj; @@ -501,12 +513,14 @@ // INSTANCE Element instanceE = (Element) searchFirstNode(pValueObjectWithLocalPathE, "INSTANCE"); - if (instanceE == null) { throw new CIMXMLParseException(); } + if (instanceE == null) { throw new CIMXMLParseException( + "VALUE.OBJECTWITHLOCALPATH element missing INSTANCE child element!"); } CIMInstance inst = parseINSTANCE(instanceE, op); // BB mod return inst; } - throw new CIMXMLParseException(); + throw new CIMXMLParseException( + "VALUE.OBJECTWITHLOCALPATH element missing required child element!"); } // //////////////////////////////////////////////////////////////////////////////////////// @@ -525,12 +539,14 @@ // <!ELEMENT NAMESPACEPATH (HOST,LOCALNAMESPACEPATH)> // HOST Element hostE = (Element) searchFirstNode(pNameSpacePathE, "HOST"); - if (hostE == null) { throw new CIMXMLParseException(); } + if (hostE == null) { throw new CIMXMLParseException( + "NAMESPACEPATH element missing HOST child element!"); } XMLHostStr xmlHostStr = new XMLHostStr(parseHOST(hostE)); // LOCALNAMESPACE Element localnamespacepathE = (Element) searchFirstNode(pNameSpacePathE, "LOCALNAMESPACEPATH"); - if (localnamespacepathE == null) { throw new CIMXMLParseException(); } + if (localnamespacepathE == null) { throw new CIMXMLParseException( + "NAMESPACEPATH element missing LOCALNAMESPACEPATH child element!"); } String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathE); /* * CIMObjectPath( String scheme, String host, String port, String @@ -554,7 +570,7 @@ Element[] nameSpaceElementA = searchNodes(pLocalNameSpaceE, "NAMESPACE"); if (nameSpaceElementA == null) { if (cLocalPathBuilder == null) throw new CIMXMLParseException( - "NAMESPACE child element is mandatory for LOCALNAMESPACEPATH element!"); + "LOCALNAMESPACEPATH element missing NAMESPACE child element!"); return cLocalPathBuilder.getBasePath().getNamespace(); } StringBuffer sb = new StringBuffer(); @@ -593,7 +609,8 @@ // <!ATTLIST NAMESPACE %NAME;> Attr namespace_nameA = (Attr) searchAttribute(pNameSpaceE, "NAME"); - if (namespace_nameA == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (namespace_nameA == null) throw new CIMXMLParseException( + "NAMESPACE element missing NAME attribute!"); String n = namespace_nameA.getValue(); return n; } @@ -610,11 +627,13 @@ // NAMESPACEPATH Element namespacepathE = (Element) searchFirstNode(pClassPathE, "NAMESPACEPATH"); - if (namespacepathE == null) { throw new CIMXMLParseException(); } + if (namespacepathE == null) { throw new CIMXMLParseException( + "CLASSPATH element missing NAMESPACEPATH child element!"); } CIMObjectPath nsPath = parseNAMESPACEPATH(namespacepathE); // CLASSNAME Element classnameE = (Element) searchFirstNode(pClassPathE, "CLASSNAME"); - if (classnameE == null) { throw new CIMXMLParseException(); } + if (classnameE == null) { throw new CIMXMLParseException( + "CLASSPATH element missing CLASSNAME child element!"); } String className = parseClassName(classnameE); /* * CIMObjectPath( String scheme, String host, String port, String @@ -637,12 +656,14 @@ // NAMESPACEPATH Element localnamespacepathE = (Element) searchFirstNode(pClassPathE, "LOCALNAMESPACEPATH"); - if (localnamespacepathE == null) { throw new CIMXMLParseException(); } + if (localnamespacepathE == null) { throw new CIMXMLParseException( + "LOCALCLASSPATH element missing LOCALNAMESPACEPATH child element!"); } String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathE); // CLASSNAME Element classnameE = (Element) searchFirstNode(pClassPathE, "CLASSNAME"); - if (classnameE == null) { throw new CIMXMLParseException(); } + if (classnameE == null) { throw new CIMXMLParseException( + "LOCALCLASSPATH element missing CLASSNAME child element!"); } CIMObjectPath op = parseCLASSNAME(classnameE); return cLocalPathBuilder.build(op.getObjectName(), nameSpace); } @@ -658,7 +679,8 @@ // <!ELEMENT CLASSNAME EMPTY> // <!ATTLIST CLASSNAME %NAME;> Attr classname_nameA = (Attr) searchAttribute(pClassNameE, "NAME"); - if (classname_nameA == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (classname_nameA == null) throw new CIMXMLParseException( + "CLASSNAME element missing NAME attribute!"); return classname_nameA.getNodeValue(); } @@ -686,11 +708,13 @@ // NAMESPACEPATH Element namespacepathE = (Element) searchFirstNode(pInstancePathE, "NAMESPACEPATH"); - if (namespacepathE == null) { throw new CIMXMLParseException(); } + if (namespacepathE == null) { throw new CIMXMLParseException( + "INSTANCEPATH element missing NAMESPACEPATH child element!"); } CIMObjectPath nsPath = parseNAMESPACEPATH(namespacepathE); // INSTANCENAME Element instancenameE = (Element) searchFirstNode(pInstancePathE, "INSTANCENAME"); - if (instancenameE == null) { throw new CIMXMLParseException(); } + if (instancenameE == null) { throw new CIMXMLParseException( + "INSTANCEPATH element missing INSTANCENAME child element!"); } CIMObjectPath op = parseINSTANCENAME(instancenameE); // ebak: change host and namespace return new CIMObjectPath(nsPath.getScheme(), nsPath.getHost(), nsPath.getPort(), nsPath @@ -711,12 +735,14 @@ // LOCALNAMESPACEPATH Element localnamespacepathE = (Element) searchFirstNode(pLocalInstancePathE, "LOCALNAMESPACEPATH"); - if (localnamespacepathE == null) { throw new CIMXMLParseException(); } + if (localnamespacepathE == null) { throw new CIMXMLParseException( + "LOCALINSTANCEPATH element missing LOCALNAMESPACEPATH child element!"); } String nameSpace = parseLOCALNAMESPACEPATH(localnamespacepathE); // INSTANCENAME Element instancenameE = (Element) searchFirstNode(pLocalInstancePathE, "INSTANCENAME"); - if (instancenameE == null) { throw new CIMXMLParseException(); } + if (instancenameE == null) { throw new CIMXMLParseException( + "LOCALINSTANCEPATH element missing INSTANCENAME child element!"); } CIMObjectPath op = parseINSTANCENAME(instancenameE); /* * CIMObjectPath(String objectName, String namespace, CIMProperty[] @@ -738,7 +764,7 @@ // <!ATTLIST INSTANCENAME %CLASSNAME;> Attr instance_classnameA = (Attr) searchAttribute(pInstanceNameE, "CLASSNAME"); if (instance_classnameA == null) throw new CIMXMLParseException( - "CLASSNAME attribute not found!"); + "INSTANCENAME element missing CLASSNAME attribute!"); String opClassName = instance_classnameA.getNodeValue(); // KEYBINDING @@ -779,7 +805,7 @@ return op; } - throw new CIMXMLParseException(); + throw new CIMXMLParseException("OBJECTPATH element missing required child element!"); } /** @@ -794,7 +820,8 @@ // <!ATTLIST KEYBINDING %NAME;> Attr keybinding_nameA = (Attr) searchAttribute(pKeyBindingE, "NAME"); - if (keybinding_nameA == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (keybinding_nameA == null) throw new CIMXMLParseException( + "KEYBINDING element missing NAME attribute!"); String propName = keybinding_nameA.getValue(); // CIMProperty prop = new CIMProperty(pName); @@ -814,7 +841,7 @@ op, true, false, null); } - throw new CIMXMLParseException(); + throw new CIMXMLParseException("KEYBINDING element missing required child element!"); } private static final TreeMap<String, CIMDataType> TYPESTR_MAP = new TreeMap<String, CIMDataType>( @@ -884,7 +911,7 @@ throws CIMXMLParseException { if (pTypeStr == null) return pArray ? CIMDataType.STRING_ARRAY_T : CIMDataType.STRING_T; CIMDataType type = TYPESTR_MAP.get(pTypeStr); - if (type == null) throw new CIMXMLParseException("Unknown type string:" + pTypeStr); + if (type == null) throw new CIMXMLParseException("Unknown TYPE string:" + pTypeStr); if (pArray) { if (type.getType() == CIMDataType.REFERENCE) return new CIMDataType(type .getRefClassName(), 0); @@ -945,7 +972,7 @@ public ValueTypeHandler(String pValueTypeStr, String pValueStr) throws CIMXMLParseException { if (pValueTypeStr == null) throw new CIMXMLParseException( - "KEYVALUE node must have a VALUETYPE attribute!"); + "KEYVALUE element missing VALUETYPE attribute!"); if (pValueTypeStr.equals("numeric")) { if (!setUInt64(pValueStr) && !setSInt64(pValueStr) && !setReal64(pValueStr)) throw new CIMXMLParseException( @@ -957,9 +984,9 @@ } } else if (pValueTypeStr.equals(MOF.DT_BOOL)) { if (!setBoolean(pValueStr)) throw new CIMXMLParseException( - "Unparsable \"boolean\" value: " + pValueStr + " !"); + "Unparseable \"boolean\" value: " + pValueStr + " !"); } else { - throw new CIMXMLParseException("KEYVALUE node's VALUETYPE attribute must be " + throw new CIMXMLParseException("KEYVALUE element's VALUETYPE attribute must be " + MOF.DT_STR + ", " + MOF.DT_BOOL + " or numeric! " + pValueStr + " is not allowed!"); } @@ -1072,7 +1099,8 @@ // <!ATTLIST CLASS %NAME;%SUPERCLASS;> Attr class_nameA = (Attr) searchAttribute(pClassE, "NAME"); - if (class_nameA == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (class_nameA == null) throw new CIMXMLParseException( + "CLASS element missing NAME attribute!"); String name = class_nameA.getNodeValue(); // Attr superclass_nameA = (Attr)searchAttribute(classE, "SUPERCLASS"); @@ -1190,7 +1218,7 @@ // %Propagated;> String name = attribute(pMethodE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException("METHOD element missing NAME attribute!"); EmbObjHandler embObjHandler = new EmbObjHandler(pMethodE); CIMDataType type = embObjHandler.getType(); if (type.isArray()) throw new CIMXMLParseException("Method's type cannot be Array!"); @@ -1215,7 +1243,8 @@ */ public static CIMParameter<Object> parsePARAMETER(Element pParamE) throws CIMXMLParseException { String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "PARAMETER element missing NAME attribute!"); EmbObjHandler iEmbObjHandler = new EmbObjHandler(pParamE); // CIMParameter(String name, CIMDataType type, CIMQualifier[] // qualifiers) @@ -1233,7 +1262,8 @@ public static CIMParameter<Object> parsePARAMETERREFERENCE(Element pParamE) throws CIMXMLParseException { String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "PARAMETER.REFERENCE element missing NAME attribute!"); String referenceClass = attribute(pParamE, "REFERENCECLASS"); CIMDataType type = new CIMDataType(referenceClass != null ? referenceClass : ""); // QUALIFIER @@ -1251,7 +1281,8 @@ public static CIMParameter<Object> parsePARAMETERARRAY(Element pParamE) throws CIMXMLParseException { String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "PARAMETER.ARRAY element missing NAME attribute!"); EmbObjHandler iEmbObjHandler = new EmbObjHandler(pParamE); return new CIMParameter<Object>(name, iEmbObjHandler.getArrayType(), iEmbObjHandler .getQualifiers()); @@ -1267,7 +1298,8 @@ public static CIMParameter<Object> parsePARAMETERREFARRAY(Element pParamE) throws CIMXMLParseException { String name = attribute(pParamE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "PARAMETER.REFARRAY element missing NAME attribute!"); String referenceClass = attribute(pParamE, "REFERENCECLASS"); @@ -1315,7 +1347,8 @@ // BB mod CIMInstance inst = new CIMInstance(); String className = attribute(pInstanceE, "CLASSNAME"); - if (className == null) throw new CIMXMLParseException("CLASSNAME attribute not found!"); + if (className == null) throw new CIMXMLParseException( + "INSTANCE element missing CLASSNAME attribute!"); // QUALIFIER // FIXME: in JSR48 CIMInstance doesn't have qualifiers // CIMQualifier[] qualis = parseQUALIFIERS(pInstanceE); @@ -1449,7 +1482,8 @@ // <!ATTLIST QUALIFIER %NAME;%TYPE;%PROPAGATED;%QUALIFIERFLAVOR;> String name = attribute(pQualifierE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "QUALIFIER element missing NAME attribute!"); boolean propagated = MOF.TRUE.equalsIgnoreCase(pQualifierE.getAttribute("PROPAGATED")); // FLAVORS int flavors = parseFLAVORS(pQualifierE); @@ -1481,7 +1515,8 @@ // %QualifierFlavor;> String name = attribute(pQualifierTypeE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "QUALIFIER.DECLARATION element missing NAME attribute!"); // SCOPES // ebak: there should be only 1 scope node @@ -1964,7 +1999,8 @@ // <!ATTLIST PROPERTY %NAME;%TYPE;%CLASSORIGIN;%PROPAGATED;> Attr property_nameA = (Attr) searchAttribute(pPropertyE, "NAME"); - if (property_nameA == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (property_nameA == null) throw new CIMXMLParseException( + "PROPERTY element missing NAME attribute!"); String name = property_nameA.getNodeValue(); String classOrigin = pPropertyE.getAttribute("CLASSORIGIN"); @@ -2012,7 +2048,8 @@ // %NAME;%TYPE;%ARRAYSIZE;%CLASSORIGIN;%PROPAGATED;> String name = pPropArrayE.getAttribute("NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "PROPERTY.ARRAY element missing NAME attribute!"); // String valueArraysizeStr = propertyarrayE.getAttribute("ARRAYSIZE"); @@ -2057,7 +2094,8 @@ // %NAME;%REFERENCECLASS;%CLASSORIGIN;%PROPAGATED;> String name = pPropRefE.getAttribute("NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "PROPERTY.REFERENCE element missing NAME attribute!"); String classOrigin = pPropRefE.getAttribute("CLASSORIGIN"); if (classOrigin != null && classOrigin.length() == 0) classOrigin = null; @@ -2097,12 +2135,12 @@ // <!ATTLIST MESSAGE %ID;%PROTOCOLVERSION;> Attr idA = (Attr) searchAttribute(pMessageE, "ID"); - if (idA == null) throw new CIMXMLParseException("ID attribute not found!"); + if (idA == null) throw new CIMXMLParseException("MESSAGE element missing ID attribute!"); String id = idA.getNodeValue(); Attr protocolA = (Attr) searchAttribute(pMessageE, "PROTOCOLVERSION"); if (protocolA == null) throw new CIMXMLParseException( - "PROTOCOLVERSION attribute not found!"); + "MESSAGE element missing PROTOCOLVERSION attribute!"); // TODO if (pCimVersion.equals("2.0") && pDtdVersion.equals("2.0")) { @@ -2172,7 +2210,7 @@ request.setId(id); return request; } - throw new CIMXMLParseException(); + throw new CIMXMLParseException("MESSAGE element missing required child element!"); } // TODO, look for the specific error message in the spec throw new CIMXMLParseException("DTD not supported"); @@ -2191,7 +2229,8 @@ // (VALUE|VALUE.REFERENCE|VALUE.ARRAY|VALUE.REFARRAY)?>) // <!ATTLIST PARAMTYPE %NAME;%PARAMTYPE%> String name = attribute(pParamValueE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "PARAMVALUE element missing NAME attribute!"); // FIXME: ebak: The base implementation didn't contain VALUE.REFARRAY // handling. Why? // ebak: embedded object support, different parsing for VALUE and @@ -2201,7 +2240,7 @@ TypedValue typedValue = parseSingleValue(pParamValueE, VALUEREF); CIMDataType type = typedValue.getType(); Object value = typedValue.getValue(); - if (type == null) throw new CIMXMLParseException("Type is null!"); + if (type == null) throw new CIMXMLParseException("PARAMVALUE element type is null!"); return new CIMArgument<Object>(name, type, value); } EmbObjHandler embObjHandler = new EmbObjHandler(pParamValueE); @@ -2224,7 +2263,8 @@ // %CIMName;> String name = attribute(pParamValueE, "NAME"); - if (name == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (name == null) throw new CIMXMLParseException( + "IPARAMVALUE element missing NAME attribute!"); // this can parse VALUE, VALUE.ARRAY and VALUE.REFERENCE TypedValue typedValue = parseSingleValue(pParamValueE, VALUE | VALUEA | VALUEREF); if (typedValue.getType() != null) { return new CIMArgument<Object>(name, typedValue @@ -2299,7 +2339,7 @@ Element imethodresponseE = (Element) searchFirstNode(pSimpleRspE, "IMETHODRESPONSE"); if (imethodresponseE != null) { return parseIMETHODRESPONSE(imethodresponseE); } - throw new CIMXMLParseException(); + throw new CIMXMLParseException("SIMPLERSP element missing required child element!"); } /** @@ -2324,7 +2364,7 @@ return multiRsp; } - throw new CIMXMLParseException("SIMPLRESP nodes aren't found!"); + throw new CIMXMLParseException("MULTIRSP element missing SIMPLERSP child element!"); } /** @@ -2345,7 +2385,7 @@ Element imethodcallE = (Element) searchFirstNode(pSimpleReqE, "IMETHODCALL"); if (imethodcallE != null) { return parseIMETHODCALL(imethodcallE); } - throw new CIMXMLParseException("METHODCALL or IMETHODCALL nodes aren't found!"); + throw new CIMXMLParseException("SIMPLEREQ element missing required child element!"); } /** @@ -2370,7 +2410,7 @@ } return multiReq; } - throw new CIMXMLParseException("MULTIREQ nodes aren't found!"); + throw new CIMXMLParseException("MULTIREQ element missing SIMPLEREQ child element!"); } /** @@ -2386,7 +2426,7 @@ // <!ATTLIST METHODCALL // %CIMName;> if (pMethodCallE.getAttribute("NAME") == null) throw new CIMXMLParseException( - "NAME attribute not found!"); + "METHODCALL element missing NAME attribute!"); CIMRequest request = new CIMRequest(); String methodname = pMethodCallE.getAttribute("CIMName"); @@ -2409,7 +2449,7 @@ request.setObjectPath(path); } else { if (!localclasspathFound) throw new CIMXMLParseException( - "LOCALCLASSPATH or LOCALINSTANCEPATH not found!"); + "METHODCALL element missing required child element!"); } Element[] paramValueElementA = searchNodes(pMethodCallE, "PARAMVALUE"); @@ -2441,7 +2481,8 @@ CIMRequest request = new CIMRequest(); String methodname = pIMethodCallE.getAttribute("NAME"); // ebak: // CIMName->NAME - if (methodname == null) throw new CIMXMLParseException("NAME attribute not found!"); + if (methodname == null) throw new CIMXMLParseException( + "IMETHODCALL element missing NAME attribute!"); request.setMethodName(methodname); // METHODCALL @@ -2481,7 +2522,7 @@ return request; } - throw new CIMXMLParseException("IPARAMVALUE node not found!"); + throw new CIMXMLParseException("IMETHODCALL element missing IPARAMVALUE child element!"); } /** @@ -2523,7 +2564,7 @@ } return multiReq; } - throw new CIMXMLParseException("SIMPLEEXREQ node not found!"); + throw new CIMXMLParseException("MULTIEXPREQ element missing SIMPLEEXPREQ child element!"); } /** @@ -2570,7 +2611,7 @@ CIMInstance inst = parseINSTANCE(instanceE); return inst; } - throw new CIMXMLParseException("INSTANCE node not found!"); + throw new CIMXMLParseException("EXPPARAMVALUE element missing INSTANCE child element!"); } /** @@ -2584,7 +2625,7 @@ throws CIMXMLParseException { // <!ELEMENT METHODRESPONSE (ERROR|(RETURNVALUE?,PARAMVALUE*))> if (pMethodResponseE.getAttribute("NAME") == null) throw new CIMXMLParseException( - "NAME attribute not found!"); + "METHODRESPONSE element missing NAME attribute!"); CIMResponse response = new CIMResponse(); @@ -2651,7 +2692,7 @@ throws CIMXMLParseException { // <!ELEMENT IMETHODRESPONSE (ERROR|(IRETURNVALUE?, PARAMVALUE*))> if (pIMethodResponseE.getAttribute("NAME") == null) throw new CIMXMLParseException( - "NAME attribute not found!"); + "IMETHODRESPONSE element missing NAME attribute!"); CIMResponse response = new CIMResponse(); // ERROR @@ -2700,7 +2741,8 @@ // <!ATTLSIT ERROR %CODE;%DESCRIPTION;> Attr error_codeA = (Attr) searchAttribute(pErrorE, "CODE"); - if (error_codeA == null) throw new CIMXMLParseException("CODE attribute not found!"); + if (error_codeA == null) throw new CIMXMLParseException( + "ERROR element missing CODE attribute!"); String code = error_codeA.getNodeValue(); int errorCode = 0; try { @@ -2753,7 +2795,7 @@ } TypedValue typedVal = parseSingleValue(pRetValE, VALUEREF); if (typedVal.getType() == null) throw new CIMXMLParseException( - "VALUE or VALUE.REFERENCE nodes not found!"); + "RETURNVALUE element missing required child element!"); Object value = typedVal.getValue(); return value; } @@ -3159,7 +3201,8 @@ Element expmethodresponseE = (Element) searchFirstNode(pSimpleExpRspE, "EXPMETHODRESPONSE"); if (expmethodresponseE != null) { return parseEXPMETHODRESPONSE(expmethodresponseE); } - throw new CIMXMLParseException("EXPMETHODRESPONSE node not found!"); + throw new CIMXMLParseException( + "SIMPLEEXPRSP element missing EXPMETHODRESPONSE child element!"); } /** |