public PacketExtension parseExtension(XmlPullParser parser) throws Exception { Date stamp = null; try { synchronized (DelayInformation.UTC_FORMAT) { stamp = DelayInformation.UTC_FORMAT.parse(parser.getAttributeValue("", "stamp")); } } catch (ParseException e) { // Try again but assuming that the date follows JEP-82 format // (Jabber Date and Time Profiles) try { synchronized (DelayInformation.NEW_UTC_FORMAT) { stamp = DelayInformation.NEW_UTC_FORMAT .parse(parser.getAttributeValue("", "stamp")); } } catch (ParseException e1) { // Last attempt. Try parsing the date assuming that it does not include milliseconds SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); stamp = formatter.parse(parser.getAttributeValue("", "stamp")); } } DelayInformation delayInformation = new DelayInformation(stamp); delayInformation.setFrom(parser.getAttributeValue("", "from")); delayInformation.setReason(parser.nextText()); return delayInformation; }
DelayInformation delayInformation = new DelayInformation(stamp); delayInformation.setFrom(parser.getAttributeValue("", "from")); //NOI18N delayInformation.setReason(parser.nextText());
DelayInformation delayInformation = new DelayInformation(stamp); delayInformation.setFrom(parser.getAttributeValue("", "from")); String reason = parser.nextText();
DelayInformation delayInformation = new DelayInformation(stamp); delayInformation.setFrom(parser.getAttributeValue("", "from")); String reason = parser.nextText();
DelayInformation delayInformation = new DelayInformation(stamp); delayInformation.setFrom(parser.getAttributeValue("", "from")); String reason = parser.nextText();