@@ -50,6 +50,7 @@ public class JacksonTranslationService implements TranslationService {
50
50
* Encode a {@link CouchbaseStorable} to a JSON string.
51
51
*
52
52
* @param source the source document to encode.
53
+ *
53
54
* @return the encoded JSON String.
54
55
*/
55
56
@ Override
@@ -72,6 +73,7 @@ public final Object encode(final CouchbaseStorable source) {
72
73
*
73
74
* @param source the source document
74
75
* @param generator the JSON generator.
76
+ *
75
77
* @throws IOException
76
78
*/
77
79
private void encodeRecursive (final CouchbaseStorable source , final JsonGenerator generator ) throws IOException {
@@ -103,6 +105,7 @@ private void encodeRecursive(final CouchbaseStorable source, final JsonGenerator
103
105
*
104
106
* @param source the source formatted document.
105
107
* @param target the target of the populated data.
108
+ *
106
109
* @return the decoded structure.
107
110
*/
108
111
@ Override
@@ -132,8 +135,9 @@ public final CouchbaseStorable decode(final Object source, final CouchbaseStorab
132
135
*
133
136
* @param parser the JSON parser with the content.
134
137
* @param target the target where the content should be stored.
135
- * @returns the decoded object.
138
+ *
136
139
* @throws IOException
140
+ * @returns the decoded object.
137
141
*/
138
142
private CouchbaseDocument decodeObject (final JsonParser parser , final CouchbaseDocument target ) throws IOException {
139
143
JsonToken currentToken = parser .nextToken ();
@@ -161,8 +165,9 @@ private CouchbaseDocument decodeObject(final JsonParser parser, final CouchbaseD
161
165
*
162
166
* @param parser the JSON parser with the content.
163
167
* @param target the target where the content should be stored.
164
- * @returns the decoded list.
168
+ *
165
169
* @throws IOException
170
+ * @returns the decoded list.
166
171
*/
167
172
private CouchbaseList decodeArray (final JsonParser parser , final CouchbaseList target ) throws IOException {
168
173
JsonToken currentToken = parser .nextToken ();
@@ -187,7 +192,9 @@ private CouchbaseList decodeArray(final JsonParser parser, final CouchbaseList t
187
192
*
188
193
* @param token the type of token.
189
194
* @param parser the parser with the content.
195
+ *
190
196
* @return the decoded primitve.
197
+ *
191
198
* @throws IOException
192
199
*/
193
200
private Object decodePrimitive (final JsonToken token , final JsonParser parser ) throws IOException {
@@ -198,7 +205,11 @@ private Object decodePrimitive(final JsonToken token, final JsonParser parser) t
198
205
case VALUE_STRING :
199
206
return parser .getValueAsString ();
200
207
case VALUE_NUMBER_INT :
201
- return parser .getValueAsInt ();
208
+ try {
209
+ return parser .getValueAsInt ();
210
+ } catch (final JsonParseException e ) {
211
+ return parser .getValueAsLong ();
212
+ }
202
213
case VALUE_NUMBER_FLOAT :
203
214
return parser .getValueAsDouble ();
204
215
default :
0 commit comments