Update of /cvsroot/sblim/jsr48-client/utst/org/sblim/cimclient/unittest/http
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17388/utst/org/sblim/cimclient/unittest/http
Modified Files:
HttpHeaderTest.java
Log Message:
2718 Bad CIMStatusCode generates NumberFormatException
Index: HttpHeaderTest.java
===================================================================
RCS file: /cvsroot/sblim/jsr48-client/utst/org/sblim/cimclient/unittest/http/HttpHeaderTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- HttpHeaderTest.java 11 Mar 2009 13:52:54 -0000 1.6
+++ HttpHeaderTest.java 12 Dec 2013 11:57:47 -0000 1.7
@@ -1,5 +1,5 @@
/**
- * (C) Copyright IBM Corp. 2005, 2009
+ * (C) Copyright IBM Corp. 2005, 2013
*
* THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
@@ -16,6 +16,7 @@
* 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)
* 2641758 2009-02-27 blaschke-oss CIM Client does not recognize HTTP extension headers
+ * 2718 2013-11-29 blaschke-oss Bad CIMStatusCode generates NumberFormatException
*/
package org.sblim.cimclient.unittest.http;
@@ -60,6 +61,7 @@
} catch (TrailerException e) {
verify("Status code", EQUAL, new Integer(e.getWBEMException().getID()),
new Integer(1));
+ verify("Status description", e.getWBEMException().getMessage() == null);
} catch (Exception e) {
throw e;
}
@@ -94,6 +96,7 @@
} catch (TrailerException e) {
verify("Status code", EQUAL, new Integer(e.getWBEMException().getID()),
new Integer(19));
+ verify("Status description", e.getWBEMException().getMessage() == null);
} catch (Exception e) {
throw e;
}
@@ -109,6 +112,60 @@
} catch (TrailerException e) {
verify("Status code", EQUAL, new Integer(e.getWBEMException().getID()),
new Integer(1));
+ verify("Status description", e.getWBEMException().getMessage() == null);
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+ {
+ ByteArrayInputStream stream = new ByteArrayInputStream("12-CIMStatusCode: one\n\n"
+ .getBytes());
+ HttpHeader header = new HttpHeader(stream);
+ try {
+ header.examineTrailer();
+ fail("No TrailerException thrown on status code 'one' as HTTP extension");
+ } catch (TrailerException e) {
+ verify("Status code", EQUAL, new Integer(e.getWBEMException().getID()),
+ new Integer(1));
+ verify("Status description", e.getWBEMException().getMessage() != null
+ && e.getWBEMException().getMessage().contains("\"one\""));
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+ {
+ ByteArrayInputStream stream = new ByteArrayInputStream(
+ "12-CIMStatusCode: one\n12-CIMStatusCodeDescription: something failed\n\n"
+ .getBytes());
+ HttpHeader header = new HttpHeader(stream);
+ try {
+ header.examineTrailer();
+ fail("No TrailerException thrown on status code 'one' as 1st HTTP extension");
+ } catch (TrailerException e) {
+ verify("Status code", EQUAL, new Integer(e.getWBEMException().getID()),
+ new Integer(1));
+ verify("Status description", "something failed".equalsIgnoreCase(e
+ .getWBEMException().getMessage()));
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+ {
+ ByteArrayInputStream stream = new ByteArrayInputStream(
+ "12-CIMStatusCodeDescription: something failed\n12-CIMStatusCode: one\n\n"
+ .getBytes());
+ HttpHeader header = new HttpHeader(stream);
+ try {
+ header.examineTrailer();
+ fail("No TrailerException thrown on status code 'one' as 2nd HTTP extension");
+ } catch (TrailerException e) {
+ verify("Status code", EQUAL, new Integer(e.getWBEMException().getID()),
+ new Integer(1));
+ verify("Status description", "something failed".equalsIgnoreCase(e
+ .getWBEMException().getMessage()));
} catch (Exception e) {
throw e;
}
|