1

I see from stack traces next crash:

java.lang.IllegalArgumentException: Invalid format: "2017-08-29T00:00:00-0700" is malformed at "T00:00:00-0700"

Here is the code that does the conversion (it is not exactly the code since it is JSON parsing):

  private final DateTimeFormatter parser = ISODateTimeFormat
    .dateOptionalTimeParser()
    .withChronology(ISOChronology.getInstance())
    .withZoneUTC();

  DateTime dt = parser.parseDateTime(dateString);

I've tried to reproduce it in a test on JVM, and it doesn't crash. I also sought to reproduce it on emulator and also it ran without exception.

Am I right that it is particular devices/versions error? Or I just made a mistake in code that reproducing the issue.

Is string from exception valid ISO date formatted string?

Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114
  • 1
    check this link https://stackoverflow.com/questions/13286127/joda-time-bug-on-certain-android-devices – AskNilesh Aug 28 '17 at 09:13
  • Thank you Nilesh, It might be the case. I'm investigating more. – Eugen Martynov Aug 28 '17 at 09:25
  • 1
    Date and time part have extended style (using literals like hyphen or colon) but the offset part is in basic style (no literals, especially no colon between hour and minute field). Mixture of extended and basic style is considered to be invalid in ISO-8601 as far as I know. You have probably to set up your individual pattern instead of using the generic method `dateOptionalTimeParser()`. – Meno Hochschild Aug 28 '17 at 10:10
  • Do you have any reference where it is stated that it is not valid? – Eugen Martynov Aug 28 '17 at 11:19
  • 2
    See section 4.2.5.2 (Local time and the difference from UTC). However, I don`t know yet if the [newest version/draft of ISO-8601](https://www.iso.org/news/2017/02/Ref2164.html) allows/mentions mixed styles. – Meno Hochschild Aug 28 '17 at 11:41
  • Thanks! Apparently, Joda time parses it without issue and the issue is really in some specific Android – Eugen Martynov Aug 28 '17 at 15:32
  • Ok, the Joda behaviour is somehow inconsistent but not the source of your problem. You should also check if the input contains any invisible chars (maybe before the T-literal). – Meno Hochschild Aug 28 '17 at 16:31

0 Answers0