本文整理汇总了Java中javax.json.JsonException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java JsonException.printStackTrace方法的具体用法?Java JsonException.printStackTrace怎么用?Java JsonException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.json.JsonException
的用法示例。
在下文中一共展示了JsonException.printStackTrace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: interpretMessage
import javax.json.JsonException; //导入方法依赖的package包/类
@Override
public ArrayList<String> interpretMessage(String request){
ArrayList<String> response = new ArrayList<>();
try {
JsonObject obj = Utils.jsonFromString(request);
int sendingId = obj.getInt("SendingID");
MessageType messageType = MessageType.valueOf(obj.getString("MessageType"));
String requestString = obj.getString("Request");
if (messageType == MessageType.CLIENT_REQUEST){
actOnMsg(requestString);
}
else {
handleControlMessage(sendingId, messageType, requestString);
}
} catch (JsonException e) {
e.printStackTrace();
}
return response;
}
示例2: interpretMessage
import javax.json.JsonException; //导入方法依赖的package包/类
public ArrayList<String> interpretMessage(String request){
ArrayList<String> response = new ArrayList<>();
try {
JsonObject obj = Utils.jsonFromString(request);
int sendingId = obj.getInt("SendingID");
MessageType messageType = MessageType.valueOf(obj.getString("MessageType"));
String requestString = obj.getString("Request");
if (messageType == MessageType.CLIENT_REQUEST){
response = actOnMsg(requestString);
}
else {
handleControlMessage(sendingId, messageType, requestString);
}
} catch (JsonException e) {
e.printStackTrace();
}
return response;
}
示例3: processData
import javax.json.JsonException; //导入方法依赖的package包/类
@Override
public void processData(List<String> jsonData) {
for (Iterator<String> iterator = jsonData.iterator(); iterator.hasNext();) {
String jsonStr = iterator.next();
JsonReader jsonReader = Json.createReader(new StringReader(jsonStr));
try {
JsonObject jsonObject = jsonReader.readObject();
String topicName = jsonObject.getString("topic", null);
if (topicName != null) {
if (topicName.equals("http")) {
JsonObject payload = jsonObject.getJsonObject("payload");
long requestTime = payload.getJsonNumber("time").longValue();
long requestDuration = payload.getJsonNumber("duration").longValue();
String requestUrl = payload.getString("url", "");
synchronized (aggregateHttpData) {
aggregateHttpData.aggregate(requestTime, requestDuration, requestUrl);
}
} else {
emit(jsonObject.toString());
}
}
} catch (JsonException je) {
// Skip this object, log the exception and keep trying with
// the rest of the list
je.printStackTrace();
}
}
emitHttp();
}
示例4: willDecode
import javax.json.JsonException; //导入方法依赖的package包/类
@Override
public boolean willDecode(String string) {
try {
Json.createReader(new StringReader(string)).readObject();
return true;
} catch (JsonException ex) {
ex.printStackTrace();
return false;
}
}
示例5: willDecode
import javax.json.JsonException; //导入方法依赖的package包/类
@Override
public boolean willDecode(String string) {
try {
Json.createReader(new StringReader(string)).readObject();
return true;
} catch (JsonException ex) {
ex.printStackTrace();
return false;
}
}