Azure / Azure/azure-documentdb-java
Cannot set a Date typed value to property for Document
- Vorherrschende Sprache
- Java
- Sterne
- 51
- Forks
- 52
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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)
```
Beitragsleitfaden
Rechercherichtung
Reproduzieren Sie die Zuweisung von Date in Document und untersuchen Sie JsonSerializable.java um Zeile 213, wo der Stacktrace den Fehler zeigt. Bestimmen Sie, ob Date-Werte von Document.set akzeptiert werden sollen; als erledigt gilt dies, wenn das Verhalten behoben oder mit einem Regressionstest oder einer dokumentierten Einschränkung eindeutig festgestellt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- databases
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100