Skip to content

Commit

Permalink
fix issue #38
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabor Bernat committed Mar 15, 2016
1 parent ee3dad3 commit d444541
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.type.TypeFactory;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -65,11 +64,11 @@ public class JsonRpcBasicServer {
public static final String VERSION = "2.0";

public static final int CODE_OK = 0;
private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger();
private static final ErrorResolver DEFAULT_ERROR_RESOLVER = new MultipleErrorResolver(AnnotationsErrorResolver.INSTANCE, DefaultErrorResolver.INSTANCE);
public static final String WEB_PARAM_ANNOTATION_CLASS_LOADER = "javax.jws.WebParam";
public static final String NAME = "name";
public static final String NULL = "null";
private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger();
private static final ErrorResolver DEFAULT_ERROR_RESOLVER = new MultipleErrorResolver(AnnotationsErrorResolver.INSTANCE, DefaultErrorResolver.INSTANCE);
private static Class<?> WEB_PARAM_ANNOTATION_CLASS;
private static Method WEB_PARAM_NAME_METHOD;

Expand Down Expand Up @@ -413,7 +412,7 @@ private Object[] convertJsonToParameters(Method m, List<JsonNode> params) throws

for (int i = 0; i < parameterTypes.length; i++) {
JsonParser paramJsonParser = mapper.treeAsTokens(params.get(i));
JavaType paramJavaType = TypeFactory.defaultInstance().constructType(parameterTypes[i]);
JavaType paramJavaType = mapper.getTypeFactory().constructType(parameterTypes[i]);
convertedParams[i] = mapper.readValue(paramJsonParser, paramJavaType);
}
return convertedParams;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.type.TypeFactory;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -265,7 +264,7 @@ private boolean isReturnTypeInvalid(Type returnType) {

private Object constructResponseObject(Type returnType, ObjectNode jsonObject) throws IOException {
JsonParser returnJsonParser = mapper.treeAsTokens(jsonObject.get(RESULT));
JavaType returnJavaType = TypeFactory.defaultInstance().constructType(returnType);
JavaType returnJavaType = mapper.getTypeFactory().constructType(returnType);
return mapper.readValue(returnJsonParser, returnJavaType);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.type.TypeFactory;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -372,7 +371,7 @@ private <T> T readResponse(Type returnType, InputStream ips) throws Throwable {
if (jsonObject.has(RESULT) && !jsonObject.get(RESULT).isNull() && jsonObject.get(RESULT) != null) {

JsonParser returnJsonParser = mapper.treeAsTokens(jsonObject.get(RESULT));
JavaType returnJavaType = TypeFactory.defaultInstance().constructType(returnType);
JavaType returnJavaType = mapper.getTypeFactory().constructType(returnType);

return mapper.readValue(returnJsonParser, returnJavaType);
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/googlecode/jsonrpc4j/ReadContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public synchronized static ReadContext getReadContext(InputStream input, ObjectM
return new ReadContext(input, mapper);
}

public JsonNode nextValue()
throws IOException {
public JsonNode nextValue() throws IOException {
return mapper.readValue(input, JsonNode.class);
}

Expand Down

0 comments on commit d444541

Please sign in to comment.