Document d = null;
try {
d = sb.build( response.getEntityInputStream() );
} catch ( Exception e ) {
throw new AcdpException( response.getClientResponseStatus().getReasonPhrase(), response.getStatus() );
}
String code = d.getRootElement().getChildText( "code" );
if ( code == null )
code = d.getRootElement()
.getChildText( "code", Namespace.getNamespace( "http://cdp.emc.com/services/rest/model" ) );
String message = d.getRootElement().getChildText( "message" );
if ( message == null )
message = d.getRootElement()
.getChildText( "message",
Namespace.getNamespace( "http://cdp.emc.com/services/rest/model" ) );
if ( code == null && message == null ) {
// not an error from CDP
throw new AcdpException( response.getClientResponseStatus().getReasonPhrase(), response.getStatus() );
}
log.debug( "Error: " + code + " message: " + message );
throw new AcdpException( message, response.getStatus(), code );
}
return response;
}