// set() stores bare JSON. We must pass an
// Object to reply so that it may be embedded into
// a larger JSON response object, hence the JSON.parse().
- response = JSON.parse(val);
+ try {
+ response = JSON.parse(val);
+ } catch(java.lang.IllegalStateException e) {
+ error = true;
+ response = "Error JSON-parsing stored value " + val;
+ }
}
break;
(HatchWebSocketHandler) params.get("socket");
PrinterJob job = null;
+
try {
job = buildPrinterJob(settings);
} catch(IllegalArgumentException e) {
socket.reply(e.toString(), msgid, false);
+ return;
}
if (showDialog != null && showDialog.booleanValue()) {
logger.info("Print dialog requested");
if (!job.showPrintDialog(null)) {
// job canceled by user
+
+ job.endJob();
socket.reply("Print job canceled", msgid);
return;
}
logger.info("printing...");
engine.print(job);
job.endJob();
-
socket.reply("Print job succeeded", msgid);
}