diff options
author | steckbrief <steckbrief@chefmail.de> | 2015-03-31 16:30:47 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2015-03-31 16:30:47 +0200 |
commit | e17b75511e7c9d8206939b742972021c5c9d6b86 (patch) | |
tree | c6d8084a40153546a7821f4e5cca9229a14ccaf1 | |
parent | 6220260df3a97a18baf32e3f4d70596cc1eec563 (diff) |
timestamp parsing reverted
Diffstat (limited to '')
-rw-r--r-- | build.gradle | 22 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/AbstractParser.java | 25 |
2 files changed, 31 insertions, 16 deletions
diff --git a/build.gradle b/build.gradle index 5219ef1d..79e147f8 100644 --- a/build.gradle +++ b/build.gradle @@ -25,15 +25,15 @@ repositories { } dependencies { - compile project(':libs:openpgp-api-lib') - compile project(':libs:MemorizingTrustManager') - compile 'com.android.support:support-v13:21.0.3' - compile 'org.bouncycastle:bcprov-jdk15on:1.51' - compile 'org.jitsi:org.otr4j:0.22' - compile 'org.gnu.inet:libidn:1.15' - compile 'com.google.zxing:core:3.1.0' - compile 'com.google.zxing:android-integration:3.1.0' - compile 'de.measite.minidns:minidns:0.1.3' + compile project(':libs:openpgp-api-lib') + compile project(':libs:MemorizingTrustManager') + compile 'com.android.support:support-v13:21.0.3' + compile 'org.bouncycastle:bcprov-jdk15on:1.51' + compile 'org.jitsi:org.otr4j:0.22' + compile 'org.gnu.inet:libidn:1.15' + compile 'com.google.zxing:core:3.1.0' + compile 'com.google.zxing:android-integration:3.1.0' + compile 'de.measite.minidns:minidns:0.1.3' } android { @@ -43,8 +43,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 21 - versionCode 61 - versionName "1.2.4" + versionCode 63 + versionName "1.2.6" } compileOptions { diff --git a/src/main/java/eu/siacs/conversations/parser/AbstractParser.java b/src/main/java/eu/siacs/conversations/parser/AbstractParser.java index 977062e2..473195bd 100644 --- a/src/main/java/eu/siacs/conversations/parser/AbstractParser.java +++ b/src/main/java/eu/siacs/conversations/parser/AbstractParser.java @@ -1,5 +1,7 @@ package eu.siacs.conversations.parser; +import android.util.Log; + import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; @@ -41,8 +43,14 @@ public abstract class AbstractParser { if (stamp == null) { return now; } - long time = parseTimestamp(stamp).getTime(); - return now < time ? now : time; + /*long time = parseTimestamp(stamp).getTime(); + return now < time ? now : time;*/ + try { + long time = parseTimestamp(stamp).getTime(); + return now < time ? now : time; + } catch (ParseException e) { + return now; + } } /** @@ -53,12 +61,19 @@ public abstract class AbstractParser { * @return Date * @throws ParseException */ - public static Date parseTimestamp(String timestamp) { - try { + public static Date parseTimestamp(String timestamp) throws ParseException { + /*try { + Log.d("TIMESTAMP", timestamp); return DatatypeFactory.newInstance().newXMLGregorianCalendar(timestamp).toGregorianCalendar().getTime(); } catch (DatatypeConfigurationException e) { + Log.d("TIMESTAMP", e.getMessage()); return new Date(); - } + }*/ + timestamp = timestamp.replace("Z", "+0000"); + SimpleDateFormat dateFormat; + timestamp = timestamp.substring(0,19)+timestamp.substring(timestamp.length() -5,timestamp.length()); + dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ",Locale.US); + return dateFormat.parse(timestamp); } protected void updateLastseen(final Element packet, final Account account, |