Skip to content

Commit 4d32e9d

Browse files
authored
Merge pull request #260 from anysoft/master
fix #251
2 parents a8500dc + 73e9d71 commit 4d32e9d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ private boolean isIdValueNotCorrect(String id, ObjectNode jsonObject) {
325325
}
326326

327327
protected boolean hasError(ObjectNode jsonObject) {
328-
return jsonObject.has(ERROR) && jsonObject.get(ERROR) != null && !jsonObject.get(ERROR).isNull();
328+
return jsonObject.has(ERROR) && jsonObject.get(ERROR) != null && !jsonObject.get(ERROR).isNull() && !(jsonObject.get(ERROR).isInt() && jsonObject.intValue()==0) ;
329329
}
330330

331331
/**
@@ -343,6 +343,7 @@ private ObjectNode internalCreateRequest(String methodName, Object arguments, St
343343
addParameters(arguments, request);
344344
addAdditionalHeaders(request);
345345
notifyBeforeRequestListener(request);
346+
addNoneArguments(request);
346347
return request;
347348
}
348349

@@ -423,6 +424,13 @@ private boolean isCollectionArguments(Object arguments) {
423424
return arguments != null && Collection.class.isInstance(arguments);
424425
}
425426

427+
private void addNoneArguments(ObjectNode request){
428+
if (!request.has(PARAMS)){
429+
//for none params add an empty array
430+
request.set(PARAMS,mapper.valueToTree(new String[0]));
431+
}
432+
}
433+
426434
private void addCollectionArguments(Object arguments, ObjectNode request) {
427435
Collection<?> args = Collection.class.cast(arguments);
428436
if (!args.isEmpty()) {

0 commit comments

Comments
 (0)