Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Timestamps are encoded differently in newer versions of vCD

  • Loading branch information...
commit d508b7a62f62b7dba1655f878b0092f732977304 1 parent 113490d
@rgerganov rgerganov authored
View
10 src/main/java/com/vmware/vcloud/nclient/NotificationMessage.java
@@ -121,8 +121,14 @@ static NotificationMessage createFromJson(String payload, Map<String, Object> he
result.success = (Boolean) data.get(JSON_KEY_STATUS);
}
if (data.containsKey(JSON_KEY_TIMESTAMP)) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
- result.timestamp = sdf.parse((String) data.get(JSON_KEY_TIMESTAMP));
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ result.timestamp = sdf.parse((String) data.get(JSON_KEY_TIMESTAMP));
+ } catch (java.text.ParseException ex) {
+ String date = (String) data.get(JSON_KEY_TIMESTAMP);
+ XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(date);
+ result.timestamp = xmlDate.toGregorianCalendar().getTime();
+ }
}
return result;
}
Please sign in to comment.
Something went wrong with that request. Please try again.