ARTEMIS-565 A few fixes around the JSON change

This commit is contained in:
Clebert Suconic 2016-07-26 11:56:28 -04:00
parent fbfbef52be
commit b7efd5db3b
3 changed files with 11 additions and 5 deletions

View File

@ -21,6 +21,7 @@ import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import javax.json.JsonArray;
import javax.json.JsonNumber;
/**
* Helper class to use ActiveMQ Artemis Core messages to manage server resources.
@ -218,7 +219,12 @@ public final class ManagementHelper {
Object[] res = ManagementHelper.getResults(message);
if (res != null) {
return res[0];
if (res[0] instanceof JsonNumber) {
return ((JsonNumber)res[0]).longValue();
}
else {
return res[0];
}
}
else {
return null;

View File

@ -631,7 +631,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
array.add(obj);
}
}
return array.toString();
return array.build().toString();
}
finally {
blockOnIO();
@ -833,7 +833,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
}
}
}
return brokers.toString();
return brokers.build().toString();
}
finally {
blockOnIO();

View File

@ -451,8 +451,8 @@ public class ScaleDownHandler {
logger.debug("Requesting ID for: " + queueName);
ClientMessage reply = requestor.request(managementMessage);
Object result = ManagementHelper.getResult(reply);
if (result != null && result instanceof Integer) {
queueID = (Integer) result;
if (result != null && result instanceof Number) {
queueID = ((Number) result).intValue();
}
requestor.close();
return queueID;