use of org.eclipse.smarthome.binding.homematic.internal.communicator.client.UnknownParameterSetException in project smarthome by eclipse.
the class RpcResponseParser method parse.
@Override
@SuppressWarnings("unchecked")
public Object[] parse(Object[] message) throws IOException {
if (message != null && message.length > 0) {
Object responseData = message[0];
if (responseData instanceof Map) {
Map<String, Object> map = (Map<String, Object>) responseData;
if (map.containsKey("faultCode")) {
Number faultCode = toNumber(map.get("faultCode"));
String faultString = toString(map.get("faultString"));
String faultMessage = String.format("%s %s (sending %s)", faultCode, faultString, request);
if (faultCode.intValue() == -1 && StringUtils.equals("Failure", faultString)) {
throw new UnknownRpcFailureException(faultMessage);
} else if (faultCode.intValue() == -3 && StringUtils.equals("Unknown paramset", faultString)) {
throw new UnknownParameterSetException(faultMessage);
}
throw new IOException(faultMessage);
}
}
return message;
}
throw new IOException("Unknown Result: " + message);
}
Aggregations