From: Dave B. <bla...@us...> - 2013-11-30 19:17:20
|
Update of /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/wbem In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv32599/src/org/sblim/cimclient/internal/wbem Modified Files: Tag: Experimental WBEMClientCIMXML.java Log Message: 2594 CR28: Support CIMErrorDescription HTTP field Index: WBEMClientCIMXML.java =================================================================== RCS file: /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/wbem/WBEMClientCIMXML.java,v retrieving revision 1.21.2.77 retrieving revision 1.21.2.78 diff -u -d -r1.21.2.77 -r1.21.2.78 --- WBEMClientCIMXML.java 10 Sep 2013 15:51:27 -0000 1.21.2.77 +++ WBEMClientCIMXML.java 30 Nov 2013 19:17:18 -0000 1.21.2.78 @@ -74,6 +74,7 @@ * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() * 2651 2013-07-31 blaschke-oss IOException when tracing the cimxml * 2662 2013-09-10 blaschke-oss Need the specific SSLHandshakeException during the cim call + * 2594 2013-11-30 blaschke-oss CR28: Support CIMErrorDescription HTTP field */ package org.sblim.cimclient.internal.wbem; @@ -1879,10 +1880,22 @@ // Benchmark.stopTransportTimer(); - // Look for CIM error, include in exception if it exists + // Look for CIM error and description, include in exception if exists String errorCIM = connection.getHeaderField("CIMError"); + String errorDescriptionCIM = null; if (errorCIM != null) { logger.trace(Level.FINER, "Found CIMError field with value \"" + errorCIM + "\""); + + errorDescriptionCIM = connection.getHeaderField("CIMErrorDescription"); + if (errorDescriptionCIM != null) { + try { + errorDescriptionCIM = URLDecoder.decode(errorDescriptionCIM, "UTF-8"); + } catch (Exception e) { + errorDescriptionCIM = null; + } + logger.trace(Level.FINER, "Found CIMErrorDescription field with value \"" + + errorDescriptionCIM + "\""); + } } // Look for OpenPegasus error details, decode and include in exception @@ -1910,7 +1923,12 @@ + "\""); } - // Format of WBEMException message is: + // If CIMErrorDescription present, format of WBEMException is: + // + // HTTP StatusCode - ReasonPhrase (CIMError: "ErrorString", + // CIMErrorDescription: "ErrorString") + // + // Otherwise, format of WBEMException message is: // // HTTP StatusCode - ReasonPhrase (CIMError: "ErrorString", OpenPegasus // Error: "ErrorString", SFCB Error: "ErrorString") @@ -1922,7 +1940,13 @@ errorMsg.append(connection.getResponseCode()); errorMsg.append(" - "); errorMsg.append(connection.getResponseMessage()); - if (errorCIM != null || errorOP != null || errorSFCB != null) { + if (errorCIM != null && errorDescriptionCIM != null) { + errorMsg.append(" (CIMError: \""); + errorMsg.append(errorCIM); + errorMsg.append("\", CIMErrorDescription: \""); + errorMsg.append(errorDescriptionCIM); + errorMsg.append("\")"); + } else if (errorCIM != null || errorOP != null || errorSFCB != null) { errorMsg.append(" ("); if (errorCIM != null) { errorMsg.append("CIMError: \""); |