From dc02d39a00d7ce7b590e1a8bb5a4971c3d1d5f2b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 24 Apr 2014 12:42:29 -0400 Subject: [PATCH] hatch bits Signed-off-by: Bill Erickson --- src/org/evergreen_ils/hatch/HatchWebSocketHandler.java | 7 ++++++- src/org/evergreen_ils/hatch/PrintManager.java | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/org/evergreen_ils/hatch/HatchWebSocketHandler.java b/src/org/evergreen_ils/hatch/HatchWebSocketHandler.java index c16a983..3a327c3 100644 --- a/src/org/evergreen_ils/hatch/HatchWebSocketHandler.java +++ b/src/org/evergreen_ils/hatch/HatchWebSocketHandler.java @@ -279,7 +279,12 @@ public class HatchWebSocketHandler { // 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; diff --git a/src/org/evergreen_ils/hatch/PrintManager.java b/src/org/evergreen_ils/hatch/PrintManager.java index b38a263..3568b8e 100644 --- a/src/org/evergreen_ils/hatch/PrintManager.java +++ b/src/org/evergreen_ils/hatch/PrintManager.java @@ -94,16 +94,20 @@ public class PrintManager { (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; } @@ -114,7 +118,6 @@ public class PrintManager { logger.info("printing..."); engine.print(job); job.endJob(); - socket.reply("Print job succeeded", msgid); } -- 2.11.0