hatch bits
authorBill Erickson <berick@esilibrary.com>
Thu, 24 Apr 2014 16:42:29 +0000 (12:42 -0400)
committerJeff Godin <jgodin@tadl.org>
Fri, 3 Jun 2016 20:38:49 +0000 (16:38 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
src/org/evergreen_ils/hatch/HatchWebSocketHandler.java
src/org/evergreen_ils/hatch/PrintManager.java

index c16a983..3a327c3 100644 (file)
@@ -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;
 
index b38a263..3568b8e 100644 (file)
@@ -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);
     }