Skip to content

Commit 6fecb1c

Browse files
committed
Polish JSON RPC support
References #378 (cherry picked from commit d79a8b0)
1 parent 06c5152 commit 6fecb1c

File tree

5 files changed

+5
-10
lines changed

5 files changed

+5
-10
lines changed

src/main/java/com/rabbitmq/tools/json/JSONReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
/**
4848
* Will be removed in 6.0
4949
*
50-
* @deprecated Use a third-party JSON library, e.g. Jackson or GJSON
50+
* @deprecated Use a third-party JSON library, e.g. Jackson or Gson
5151
*/
5252
public class JSONReader {
5353

src/main/java/com/rabbitmq/tools/json/JSONSerializable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
* Will be removed in 6.0
2323
*
24-
* @deprecated Use a third-party JSON library, e.g. Jackson or GJSON
24+
* @deprecated Use a third-party JSON library, e.g. Jackson or Gson
2525
*/
2626
public interface JSONSerializable {
2727
/**

src/main/java/com/rabbitmq/tools/json/JSONWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
/**
5757
* Will be removed in 6.0
58-
* @deprecated Use a third-party JSON library, e.g. Jackson or GJSON
58+
* @deprecated Use a third-party JSON library, e.g. Jackson or Gson
5959
*/
6060
public class JSONWriter {
6161
private boolean indentMode = false;

src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class DefaultJsonRpcMapper implements JsonRpcMapper {
3838

3939
@Override
4040
public JsonRpcRequest parse(String requestBody, ServiceDescription description) {
41+
@SuppressWarnings("unchecked")
4142
Map<String, Object> request = (Map<String, Object>) new JSONReader().read(requestBody);
4243
return new JsonRpcRequest(
4344
request.get("id"), request.get("version").toString(), request.get("method").toString(),
@@ -47,6 +48,7 @@ public JsonRpcRequest parse(String requestBody, ServiceDescription description)
4748

4849
@Override
4950
public JsonRpcResponse parse(String responseBody, Class<?> expectedType) {
51+
@SuppressWarnings("unchecked")
5052
Map<String, Object> map = (Map<String, Object>) (new JSONReader().read(responseBody));
5153
Map<String, Object> error;
5254
JsonRpcException exception = null;

src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ public void rpc() {
5858
Date returnedDate = service.procedureDateDate(date);
5959
assertEquals(date.getTime(), returnedDate.getTime());
6060

61-
try {
62-
service.procedureException();
63-
fail("Remote procedure throwing exception, an exception should have been thrown");
64-
} catch (UndeclaredThrowableException e) {
65-
assertTrue(e.getCause() instanceof JsonRpcException);
66-
}
67-
6861
Pojo pojo = new Pojo();
6962
pojo.setStringProperty("hello");
7063
assertEquals("hello", service.procedurePojoToString(pojo));

0 commit comments

Comments
 (0)