Azure / Azure/azure-documentdb-java

Cannot set a Date typed value to property for Document

未关闭
#101 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
51
派生
52
PR 合并指标
30 天内没有已合并 PR

描述

Not sure whether this is a bug or it's a must follow rule to use the Document.

SDK version: `1.15.2`

Suppose a POJO class with Date typed field:
```java
class MyPojo {
private String id;
private Date date;
// .. others omitted
}
```

Create a Document and configure the property value.
```java
Document document = new Document();
document.set("date", new Date()); // Exception will be thrown as Date cannot be handled, trace below
....
```

Exception trace:
```
A JSONObject text must begin with '{' at 1 [character 2 line 1]
org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
at org.json.JSONObject.(JSONObject.java:194)
at org.json.JSONObject.(JSONObject.java:321)
at com.microsoft.azure.documentdb.JsonSerializable.set(JsonSerializable.java:213)
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。