From: Dave B. <bla...@us...> - 2013-05-02 20:19:53
|
Update of /cvsroot/sblim/jsr48-client/utst/org/sblim/cimclient/unittest/cim In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6994/utst/org/sblim/cimclient/unittest/cim Modified Files: Tag: Experimental CIMDataTypeTest.java Log Message: 2632 Potential Null Point Exception in CIMDataType Index: CIMDataTypeTest.java =================================================================== RCS file: /cvsroot/sblim/jsr48-client/utst/org/sblim/cimclient/unittest/cim/CIMDataTypeTest.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -d -r1.1.2.4 -r1.1.2.5 --- CIMDataTypeTest.java 4 Dec 2012 19:40:16 -0000 1.1.2.4 +++ CIMDataTypeTest.java 2 May 2013 20:19:50 -0000 1.1.2.5 @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2012 + * (C) Copyright IBM Corp. 2012, 2013 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE @@ -15,6 +15,7 @@ * 3513353 2012-03-30 blaschke-oss TCK: CIMDataType arrays must have length >= 1 * 3513349 2012-03-31 blaschke-oss TCK: CIMDataType must not accept null string * 3592502 2012-12-04 blaschke-oss Enhance CIMDataType unit test + * 2632 2013-05-02 blaschke-oss Potential Null Point Exception in CIMDataType */ package org.sblim.cimclient.unittest.cim; @@ -276,5 +277,22 @@ verify("Bad data type did not result in IllegalArgumentException", e instanceof IllegalArgumentException); } + + try { + type = CIMDataType.getDataType(new CIMObjectPath[] { null, null, this.copA[0] }); + verify( + "COP array with one non-null entry did not result in exception but type invalid: " + + type.getType(), type.getType() == CIMDataType.REFERENCE); + } catch (Exception e) { + verify("COP array with one non-null entry resulted in exception", false); + } + + try { + type = CIMDataType.getDataType(new CIMObjectPath[] { null, null, null }); + verify("COP array with all null entries did not result in exception", false); + } catch (Exception e) { + verify("COP array with all null entries did not result in IllegalArgumentException", + e instanceof IllegalArgumentException); + } } } |