From: Dave B. <bla...@us...> - 2011-05-31 14:23:14
|
Update of /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/cimxml In directory vz-cvs-3.sog:/tmp/cvs-serv15788/src/org/sblim/cimclient/internal/cimxml Modified Files: CIMXMLParserImpl.java Log Message: 3297028 - Instances contain CIMClassProperty with DOM parser Index: CIMXMLParserImpl.java =================================================================== RCS file: /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/cimxml/CIMXMLParserImpl.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- CIMXMLParserImpl.java 31 May 2011 14:06:47 -0000 1.41 +++ CIMXMLParserImpl.java 31 May 2011 14:23:12 -0000 1.42 @@ -48,6 +48,7 @@ * 3027479 2010-07-09 blaschke-oss Dead store to local variable * 3027615 2010-07-12 blaschke-oss Use CLASS_ARRAY_T instead of new CIMDataType(CLASS,0) * 3293248 2011-05-03 blaschke-oss Support for CIM_ERROR instances within ERROR + * 3297028 2011-05-03 blaschke-oss Instances contain CIMClassProperty with DOM parser */ package org.sblim.cimclient.internal.cimxml; @@ -1523,7 +1524,20 @@ */ public static CIMProperty<?>[] parsePROPERTIES(Element pElement) throws CIMXMLParseException { Vector<CIMClassProperty<?>> classPropVec = parseClassPropsToVec(pElement); - return classPropVec.toArray(new CIMProperty[0]); + // The following does not convert Vector<CIMClassProperty> to + // CIMProperty[], it is still CIMClassProperty[]!!! You can treat it + // like a CIMProperty (property.getValue(), etc.) but (property + // instanceof CIMProperty) will return false! + // return classPropVec.toArray(new CIMProperty[0]); + + int arraySize = classPropVec.size(); + CIMProperty<?>[] retA = new CIMProperty[arraySize]; + for (int i = 0; i < arraySize; i++) { + CIMClassProperty<?> prop = classPropVec.get(i); + retA[i] = new CIMProperty<Object>(prop.getName(), prop.getDataType(), prop.getValue(), + prop.isKey(), prop.isPropagated(), prop.getOriginClass()); + } + return retA; } /** |