Azure / Azure/azure-documentdb-java

Cannot set a Date typed value to property for Document

Đang mở
#101 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
51
Fork
52
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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)
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.