ARTEMIS-565 JSON fixes
This commit is contained in:
parent
f44e87f43e
commit
7917f4d2f2
|
@ -126,6 +126,21 @@ public final class JsonUtil {
|
|||
else if (innerVal instanceof JsonString) {
|
||||
innerVal = ((JsonString)innerVal).getString();
|
||||
}
|
||||
else if (innerVal == JsonValue.FALSE) {
|
||||
innerVal = Boolean.FALSE;
|
||||
}
|
||||
else if (innerVal == JsonValue.TRUE) {
|
||||
innerVal = Boolean.TRUE;
|
||||
}
|
||||
else if (innerVal instanceof JsonNumber) {
|
||||
JsonNumber jsonNumber = (JsonNumber)innerVal;
|
||||
if (jsonNumber.isIntegral()) {
|
||||
innerVal = jsonNumber.longValue();
|
||||
}
|
||||
else {
|
||||
innerVal = jsonNumber.doubleValue();
|
||||
}
|
||||
}
|
||||
else if (innerVal instanceof JsonObject) {
|
||||
Map<String, Object> innerMap = new HashMap<>();
|
||||
JsonObject o = (JsonObject) innerVal;
|
||||
|
@ -135,10 +150,6 @@ public final class JsonUtil {
|
|||
}
|
||||
innerVal = innerMap;
|
||||
}
|
||||
else if (innerVal instanceof JsonNumber) {
|
||||
JsonNumber jsonNumber = (JsonNumber)innerVal;
|
||||
innerVal = jsonNumber.longValue();
|
||||
}
|
||||
if (CompositeData.class.getName().equals(key)) {
|
||||
Object[] data = (Object[]) innerVal;
|
||||
CompositeData[] cds = new CompositeData[data.length];
|
||||
|
@ -155,6 +166,24 @@ public final class JsonUtil {
|
|||
|
||||
array[i] = map;
|
||||
}
|
||||
else if (val instanceof JsonString) {
|
||||
array[i] = ((JsonString)val).getString();
|
||||
}
|
||||
else if (val == JsonValue.FALSE) {
|
||||
array[i] = Boolean.FALSE;
|
||||
}
|
||||
else if (val == JsonValue.TRUE) {
|
||||
array[i] = Boolean.TRUE;
|
||||
}
|
||||
else if (val instanceof JsonNumber) {
|
||||
JsonNumber jsonNumber = (JsonNumber)val;
|
||||
if (jsonNumber.isIntegral()) {
|
||||
array[i] = jsonNumber.longValue();
|
||||
}
|
||||
else {
|
||||
array[i] = jsonNumber.doubleValue();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (val == JsonValue.NULL) {
|
||||
array[i] = null;
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ManagementHelperTest extends Assert {
|
|||
String resource = RandomUtil.randomString();
|
||||
String operationName = RandomUtil.randomString();
|
||||
|
||||
int i = RandomUtil.randomInt();
|
||||
long i = RandomUtil.randomInt();
|
||||
String s = RandomUtil.randomString();
|
||||
double d = RandomUtil.randomDouble();
|
||||
boolean b = RandomUtil.randomBoolean();
|
||||
|
@ -192,7 +192,7 @@ public class ManagementHelperTest extends Assert {
|
|||
ManagementHelperTest.log.info("val1 type is " + Arrays.toString(val1));
|
||||
|
||||
String key2 = RandomUtil.randomString();
|
||||
Integer[] val2 = new Integer[]{1, 2, 3, 4, 5};
|
||||
Long[] val2 = new Long[]{1L, 2L, 3L, 4L, 5L};
|
||||
|
||||
ManagementHelperTest.log.info("val2 type is " + Arrays.toString(val2));
|
||||
|
||||
|
|
Loading…
Reference in New Issue