in src/main/java/com/aliyun/mns/model/serialize/queue/ErrorReceiptHandleListDeserializer.java [45:80]
public Exception deserialize(InputStream stream) throws Exception {
// byte[] bytes = new byte[1024];
// while(stream.read(bytes, 0, stream.available())>0){
// System.out.println(new String(bytes));
// }
Document doc = getDocumentBuilder().parse(stream);
Exception ret = null;
Element root = doc.getDocumentElement();
if (root != null) {
String rootName = root.getNodeName();
if (rootName == ERROR_LIST_TAG) {
NodeList list = doc.getElementsByTagName(ERROR_TAG);
if (list != null && list.getLength() > 0) {
Map<String, ErrorMessageResult> results = new HashMap<String, ErrorMessageResult>();
for (int i = 0; i < list.getLength(); i++) {
String receiptHandle = parseReceiptHandle((Element) list.item(i));
ErrorMessageResult result = parseErrorResult((Element) list.item(i));
results.put(receiptHandle, result);
}
ret = new BatchDeleteException(results);
}
} else if (rootName == ERROR_TAG) {
String code = safeGetElementContent(root, ERROR_CODE_TAG, "");
String message = safeGetElementContent(root, ERROR_MESSAGE_TAG, "");
String requestId = safeGetElementContent(root, ERROR_REQUEST_ID_TAG, "");
String hostId = safeGetElementContent(root, ERROR_HOST_ID_TAG, "");
ret = new ServiceException(message, null, code, requestId, hostId);
}
}
return ret;
}