GSon无法解析日期 - 引起:java.lang.NumberFormatException:2015-11-08T11

时间:2016-12-13 11:32:53

标签: android json gson

我有这堂课:

public class CommentLiferay {
    @SerializedName("id")
    private String id;
    @SerializedName("username")
    private String username;
    @SerializedName("date")
    private Date date;
    @SerializedName("text")
    private String text;
    @SerializedName("replyComments")
    private List<CommentLiferay> replyComments;

    public CommentLiferay() {
    }

    public CommentLiferay(String id, String username, Date date, String text, List<CommentLiferay> replyComments) {
        this.id = id;
        this.username = username;
        this.date = date;
        this.text = text;
        this.replyComments = replyComments;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public List<CommentLiferay> getReplyComments() {
        return replyComments;
    }

    public void setReplyComments(List<CommentLiferay> replyComments) {
        this.replyComments = replyComments;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CommentLiferay that = (CommentLiferay) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public String toString() {
        return "CommentLiferay{" +
                "id='" + id + '\'' +
                ", username='" + username + '\'' +
                ", date=" + date +
                ", text='" + text + '\'' +
                ", replyComments=" + replyComments +
                '}';
    }
}

然后我尝试在https://jsonformatter.curiousconcept.com/

中解析这个json :(已经过验证)
[
  {
    "id": "2ef60887-de46-48d4-8b49-43a83ecfb18a",
    "date": "2014-09-13T07:57:11 -02:00",
    "text": "In pariatur aliquip exercitation commodo magna qui enim consequat eu ad nostrud amet esse Lorem. Cupidatat labore ad eu qui minim consectetur dolor exercitation. Cillum consectetur est eu nostrud eiusmod enim do magna veniam occaecat dolor ut dolor. Mollit consectetur dolore commodo exercitation. Et commodo irure aliqua officia proident ullamco. Aliquip ea ex excepteur labore eu aute ea reprehenderit officia.\r\n",
    "username": "Watts",
    "replyComments": [
      {
        "id": "607c5e27-8376-4ae8-8fbd-26cdd5d5be03",
        "date": "2016-07-14T09:32:50 -02:00",
        "text": "Ut elit nulla irure cupidatat dolore cillum anim. Id minim duis esse sint irure et ullamco. Veniam Lorem incididunt magna esse aute consequat adipisicing aute officia. Ut occaecat anim ullamco ad non officia. Velit ea ullamco adipisicing id magna fugiat consequat. Velit aute ea excepteur fugiat duis cupidatat minim anim excepteur cillum.\r\n",
        "username": "Charlotte",
        "replyComments": [
          {
            "id": "b6e07b67-3292-49df-b0a6-7836e39d4b69",
            "date": "2014-10-29T12:32:12 -01:00",
            "text": "Minim minim quis consequat consectetur tempor quis esse aute magna ad tempor. Duis reprehenderit proident id ut nostrud magna qui aliqua amet voluptate. Magna non dolor cupidatat officia aute dolor et dolore. Aliquip aliquip eiusmod eu ut reprehenderit quis nisi. Nulla ullamco cupidatat eiusmod id excepteur dolore dolore cupidatat. Veniam mollit nulla enim excepteur minim dolore culpa mollit qui mollit sit. Anim elit voluptate magna irure laborum laborum ea amet veniam nostrud Lorem fugiat.\r\n",
            "username": "Diaz",
            "replyComments": []
          }
        ]
      }
    ]
  },
  {
    "id": "b4249176-5b64-4c1b-b98c-ebf1e7ecd85a",
    "date": "2014-05-19T12:44:31 -02:00",
    "text": "Adipisicing Lorem labore dolor dolore qui fugiat nisi. Anim consectetur et ut id reprehenderit quis do duis deserunt quis cillum. Esse commodo ipsum eiusmod occaecat tempor laborum amet.\r\n",
    "username": "Lesa",
    "replyComments": [
      {
        "id": "99c6fa76-96f2-44cf-b6c3-c62e58e30110",
        "date": "2015-07-02T05:03:20 -02:00",
        "text": "Occaecat eu sint eu dolor commodo ut in in magna in nulla do. Eu do fugiat aute reprehenderit pariatur aliquip. Laborum esse minim dolore occaecat officia minim id velit consequat reprehenderit dolore nisi. Irure cupidatat amet esse fugiat veniam. Dolore laboris ullamco pariatur in eiusmod. Fugiat consectetur enim ad quis reprehenderit anim velit elit tempor ea officia culpa Lorem. Non ipsum velit sunt aliquip ad ea nisi qui aliqua sunt ex ut laboris.\r\n",
        "username": "Molly",
        "replyComments": [
          {
            "id": "f94548c4-d024-48e8-ba20-052c23d4d802",
            "date": "2015-03-07T10:53:58 -01:00",
            "text": "Ad magna mollit nisi ea est. Ad ex laborum aliqua consequat officia ipsum incididunt. Nulla adipisicing eu ipsum deserunt mollit sit. Cupidatat magna ad fugiat proident est sit Lorem nulla. Veniam eu exercitation duis elit anim occaecat culpa mollit deserunt nulla. Tempor labore sit dolore excepteur ullamco cillum ad mollit et minim ut. Magna nostrud reprehenderit consequat consectetur cupidatat laborum pariatur et qui.\r\n",
            "username": "Guerrero",
            "replyComments": [
              {
                "id": "d12724d3-e95c-4d0a-b1c6-e36607b04751",
                "date": "2015-04-21T09:36:48 -02:00",
                "text": "Eiusmod fugiat pariatur non aliquip. Nisi anim excepteur nulla incididunt voluptate magna veniam enim pariatur cupidatat consectetur nostrud. Consequat ullamco ex officia ad ut incididunt. Labore nulla adipisicing non ullamco aliqua Lorem aute aute ex culpa. Dolor elit consectetur enim mollit ut commodo ut nulla laboris.\r\n",
                "username": "Rosario",
                "replyComments": []
              },
              {
                "id": "bf08c784-446a-4dc9-9d2e-d9e9fa2e9752",
                "date": "2016-08-18T06:48:38 -02:00",
                "text": "Enim ex mollit elit enim dolor ex. Excepteur laboris sit ea nisi laborum voluptate fugiat non occaecat magna Lorem ex. Ut aute Lorem incididunt culpa aliquip eiusmod aliquip dolore ad ex ad consequat eu exercitation. Irure dolor anim aliquip adipisicing.\r\n",
                "username": "Marcie",
                "replyComments": []
              }
            ]
          },
          {
            "id": "10b22444-0472-405c-8480-2d9701a6ba39",
            "date": "2015-06-08T02:36:06 -02:00",
            "text": "Dolore anim nostrud sit non proident aliquip consequat id excepteur incididunt non. Dolore ipsum ipsum ea officia ipsum mollit nisi consequat. Cupidatat culpa quis aute dolor ex irure ullamco pariatur in ad sunt.\r\n",
            "username": "Nelson",
            "replyComments": [
              {
                "id": "a468cfe7-5b6c-4fac-b3c2-04845190e603",
                "date": "2016-07-30T09:16:16 -02:00",
                "text": "Mollit consequat do aute enim cillum ipsum. Ipsum nulla deserunt reprehenderit cillum ad ad duis commodo commodo nostrud. Cillum velit laborum irure cupidatat. Aliqua commodo enim nulla nisi cupidatat reprehenderit veniam non. In esse consectetur duis eiusmod exercitation laboris ea. Lorem sit esse ullamco consectetur incididunt ea excepteur exercitation dolore ullamco ex exercitation ea dolore.\r\n",
                "username": "Rosalind",
                "replyComments": []
              }
            ]
          }
        ]
      }
    ]
  },
  {
    "id": "c262ae30-de34-4451-974e-cccf36a72ca4",
    "date": "2015-09-14T06:46:50 -02:00",
    "text": "Minim consectetur id esse velit exercitation et eiusmod qui. Dolor pariatur duis aliqua dolore mollit ad irure amet duis aliquip. Consequat deserunt aute sit enim nisi sint aute sint aute consequat. Elit sit ut deserunt veniam dolore. Consequat nulla nulla aute adipisicing labore eiusmod sunt ad sunt exercitation elit anim adipisicing ex.\r\n",
    "username": "Barber",
    "replyComments": [
      {
        "id": "408b0725-d4f8-4e99-ae7d-2170d8342c6f",
        "date": "2016-02-28T10:04:08 -01:00",
        "text": "Enim proident tempor exercitation dolor laboris nostrud excepteur ut consectetur eu Lorem. Non excepteur excepteur adipisicing consequat officia. Id quis cillum aute ad reprehenderit ullamco eiusmod culpa.\r\n",
        "username": "Benson",
        "replyComments": [
          {
            "id": "ce3565e2-2932-4281-b774-428916ace2cd",
            "date": "2015-04-11T07:43:09 -02:00",
            "text": "Ullamco aute officia ipsum magna enim minim aute. Nostrud nostrud aliqua tempor fugiat elit. Sint in amet eiusmod incididunt aute aute veniam duis.\r\n",
            "username": "Rowland",
            "replyComments": [
              {
                "id": "ae6d1739-856f-4bf6-a0c7-ec3cfaeeec59",
                "date": "2016-07-09T03:28:37 -02:00",
                "text": "Occaecat deserunt amet esse magna proident ipsum Lorem aute reprehenderit tempor excepteur tempor do. Eiusmod ex ex fugiat occaecat pariatur. Culpa irure magna culpa consequat excepteur.\r\n",
                "username": "Best",
                "replyComments": []
              }
            ]
          }
        ]
      }
    ]
  },
  {
    "id": "26983176-06f6-436e-88e3-c8c1cdf01aeb",
    "date": "2016-10-20T04:15:58 -02:00",
    "text": "Tempor elit sunt non Lorem sunt qui laboris officia. Fugiat in commodo aute do fugiat cillum. Quis aliqua qui et id nisi elit dolore minim commodo ea adipisicing. Deserunt laborum fugiat elit id laborum ut commodo occaecat. Pariatur cillum veniam exercitation laboris qui labore tempor sit.\r\n",
    "username": "Amy",
    "replyComments": [
      {
        "id": "bbc27bc4-6387-495d-a1f6-9df495eec15d",
        "date": "2014-04-18T07:47:40 -02:00",
        "text": "Ex magna ex pariatur occaecat magna commodo Lorem anim ex laborum amet reprehenderit irure. Tempor enim aliquip sunt aute laborum consequat nostrud laboris commodo. Exercitation qui anim consectetur deserunt laboris exercitation est aliquip ut aliqua in. Culpa irure eiusmod adipisicing dolor cupidatat ullamco elit qui velit esse incididunt nisi voluptate ut. Id elit ea aute ut ea in commodo mollit adipisicing. Voluptate irure cillum ut mollit elit quis voluptate fugiat.\r\n",
        "username": "Donaldson",
        "replyComments": [
          {
            "id": "d15fecb0-10f3-4cbf-afc6-c24f27502637",
            "date": "2014-07-17T01:02:24 -02:00",
            "text": "Labore irure sunt nisi exercitation mollit veniam sint ullamco ullamco adipisicing reprehenderit quis. Nulla reprehenderit aliqua nulla consectetur. Cillum eu incididunt et excepteur tempor. Id exercitation ex esse nulla elit pariatur. Pariatur magna ullamco nostrud sint ea excepteur nisi nisi.\r\n",
            "username": "Holder",
            "replyComments": [
              {
                "id": "0b3b0ffe-b0af-41d5-87a4-8d5e59b8f51d",
                "date": "2014-11-08T06:40:18 -01:00",
                "text": "Esse ipsum anim et minim sunt ut proident. Proident velit laboris dolor mollit ad fugiat elit occaecat occaecat. Minim aute enim incididunt do pariatur ea Lorem laborum dolor. Cupidatat laboris aliqua ullamco et. Tempor anim id eu non id non ullamco ea velit qui consectetur dolor. Duis consequat quis amet tempor proident mollit ea laboris in consequat exercitation minim sunt. Voluptate occaecat aute occaecat irure non occaecat et dolor Lorem sint culpa.\r\n",
                "username": "Norma",
                "replyComments": []
              },
              {
                "id": "c8dd6fc3-b49c-47dc-bfd4-e31aaec97259",
                "date": "2016-03-27T08:18:16 -02:00",
                "text": "Ullamco sunt magna ipsum esse ad in est incididunt culpa excepteur consectetur. Aliqua non ipsum reprehenderit occaecat ea amet exercitation amet eiusmod ut. Fugiat veniam occaecat et esse ut reprehenderit Lorem velit officia cillum deserunt aliqua dolore irure.\r\n",
                "username": "Vinson",
                "replyComments": []
              }
            ]
          },
          {
            "id": "9677523b-5064-4a88-bec2-58439e219303",
            "date": "2015-01-26T06:24:44 -01:00",
            "text": "Nulla sit occaecat magna non pariatur aliqua quis culpa dolor nisi deserunt. Culpa nostrud esse commodo sit laboris ipsum. Velit et ullamco deserunt esse ea laborum ipsum ut Lorem officia. Dolore aliqua ad do veniam et sint voluptate proident sit. Laborum non incididunt ullamco minim dolor Lorem non consequat. Amet commodo reprehenderit consequat do officia et nostrud quis elit. Consectetur reprehenderit in adipisicing veniam aliqua enim ut minim consectetur veniam laborum dolor quis.\r\n",
            "username": "Tommie",
            "replyComments": [
              {
                "id": "16c1a749-4601-4931-b5c2-1eb4b08c09d0",
                "date": "2014-04-20T10:05:11 -02:00",
                "text": "Excepteur eiusmod aliquip ex adipisicing sit id laboris quis nisi commodo culpa qui consectetur. Adipisicing commodo anim irure tempor culpa laboris qui velit sunt aliqua dolor. Nulla eiusmod laborum irure fugiat cillum deserunt culpa laboris laboris consequat.\r\n",
                "username": "Betsy",
                "replyComments": []
              }
            ]
          }
        ]
      },
      {
        "id": "e585bd90-b7d8-4af2-b9ac-a66b59ad7424",
        "date": "2016-09-05T11:00:38 -02:00",
        "text": "Nisi voluptate aliquip dolore sit aliquip do eiusmod culpa est magna consequat nulla. Qui Lorem ipsum et duis esse minim et. Dolor ipsum nostrud commodo commodo fugiat irure laborum irure est ex in. Veniam culpa pariatur sint nulla. Sint nulla tempor cillum eiusmod proident mollit duis occaecat nostrud. Commodo enim nulla veniam excepteur nostrud sit excepteur sit. Aliquip in excepteur ea dolore non incididunt qui.\r\n",
        "username": "Sheila",
        "replyComments": [
          {
            "id": "914c708e-31aa-4491-a5e9-d93056f3b81b",
            "date": "2016-03-17T12:05:48 -01:00",
            "text": "Minim anim culpa aute exercitation cupidatat officia anim quis et reprehenderit ut sint occaecat occaecat. Sint excepteur occaecat ullamco elit officia ipsum ad sit ullamco ipsum. Laborum enim ad irure irure sunt qui. Aute veniam duis incididunt sunt incididunt laboris. Nostrud exercitation et dolor nulla excepteur minim.\r\n",
            "username": "Faith",
            "replyComments": []
          },
          {
            "id": "b6e436ae-465a-4cac-ab29-551603aab248",
            "date": "2016-05-15T01:43:27 -02:00",
            "text": "Eiusmod id ipsum veniam cillum. Officia Lorem minim laborum sunt minim in nulla elit labore. Ipsum nulla excepteur elit laboris sint nostrud ea magna et.\r\n",
            "username": "Quinn",
            "replyComments": [
              {
                "id": "e9182d09-49d6-4370-a7eb-ef10afbcae90",
                "date": "2015-10-26T01:42:29 -01:00",
                "text": "Adipisicing amet consectetur adipisicing eiusmod ullamco commodo. Cupidatat cupidatat ea mollit Lorem ea non amet adipisicing. Ut amet eiusmod magna dolor tempor amet minim. Consectetur non ad ut nulla. Nostrud sit commodo aliqua ad minim minim sit non culpa tempor pariatur.\r\n",
                "username": "Luann",
                "replyComments": []
              },
              {
                "id": "5196233a-c94a-43b5-86bb-db997248012c",
                "date": "2016-07-07T07:44:38 -02:00",
                "text": "Velit cillum nulla irure tempor excepteur non deserunt officia consectetur pariatur. Laboris excepteur elit officia nostrud sint qui anim labore ex velit minim proident. Exercitation fugiat ex aliquip dolore non labore magna in incididunt id voluptate sunt. Do sunt cupidatat dolor dolore ipsum dolore incididunt qui cupidatat aute culpa ipsum.\r\n",
                "username": "Gina",
                "replyComments": []
              }
            ]
          }
        ]
      }
    ]
  }
]

然后解析它,我做:

Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
        List<CommentLiferay> commentsList = gson.fromJson(json, new TypeToken<List<CommentLiferay>>() {}.getType());
        Logger.d(commentsList);

但是当它试图解析It时会发出这个错误:

Caused by: com.google.gson.JsonSyntaxException: 2014-09-13T07
                      at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:107)
                      at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:84)
                      at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:38)
                      at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)
                      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:116)
                      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:216)
                      at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
                      at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
                      at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
                      at com.google.gson.Gson.fromJson(Gson.java:879)
                      at com.google.gson.Gson.fromJson(Gson.java:844)
                      at com.google.gson.Gson.fromJson(Gson.java:793)
                      at es.in2.in2tant.Plugins.Liferay.Activity.CommentsLiferayActivity.onCreate(CommentsLiferayActivity.java:43)
                      at android.app.Activity.performCreate(Activity.java:6876)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
                      at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:158) 
                      at android.app.ActivityThread.main(ActivityThread.java:7229) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                   Caused by: java.text.ParseException: Failed to parse date ["2014-09-13T07']: 2014-09-13T07 (at offset 0)
                      at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:274)
                      at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:105)
                      at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:84) 
                      at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:38) 
                      at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) 
                      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:116) 
                      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:216) 
                      at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) 
                      at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82) 
                      at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) 
                      at com.google.gson.Gson.fromJson(Gson.java:879) 
                      at com.google.gson.Gson.fromJson(Gson.java:844) 
                      at com.google.gson.Gson.fromJson(Gson.java:793) 
                      at es.in2.in2tant.Plugins.Liferay.Activity.CommentsLiferayActivity.onCreate(CommentsLiferayActivity.java:43) 
                      at android.app.Activity.performCreate(Activity.java:6876) 
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
                      at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:158) 
                      at android.app.ActivityThread.main(ActivityThread.java:7229) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                   Caused by: java.lang.NumberFormatException: 2014-09-13T07
                      at com.google.gson.internal.bind.util.ISO8601Utils.parseInt(ISO8601Utils.java:302)
                      at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:166)
                      at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:105) 
                      at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:84) 
                      at com.google.gson.DefaultDateTypeAdapter.deserialize(DefaultDateTypeAdapter.java:38) 
                      at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) 
                      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:116) 
                      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:216) 
                      at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) 
                      at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82) 
                      at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) 
                      at com.google.gson.Gson.fromJson(Gson.java:879) 
                      at com.google.gson.Gson.fromJson(Gson.java:844) 
                      at com.google.gson.Gson.fromJson(Gson.java:793) 
                      at es.in2.in2tant.Plugins.Liferay.Activity.CommentsLiferayActivity.onCreate(CommentsLiferayActivity.java:43) 
                      at android.app.Activity.performCreate(Activity.java:6876) 
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
                      at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:158) 
                      at android.app.ActivityThread.main(ActivityThread.java:7229) 
                      at java.lang.reflect.Method.invoke(Native Method)

我该如何解决?

1 个答案:

答案 0 :(得分:2)

2015-09-14T06:46:50 -02:00之类的日期时间与yyyy-MM-dd'T'HH:mm:ss.SSS'Z'格式不符。数据中没有小数秒或文字Z

类似yyyy-MM-dd'T'HH:mm:ss XXX之类的内容可能更适合您的数据。 X模式字符用于ISO 8601时区,其长格式为-02:00