Handle error when the browser is closed before getting the whole HTML report
authorCarlos Aristu <carlos.aristu@openbravo.com>
Mon, 11 May 2015 13:33:21 +0200
changeset 26742 308acb16ee13
parent 26741 d2bbde0c3d66
child 26743 05633081f012
Handle error when the browser is closed before getting the whole HTML report
modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java	Fri May 08 11:17:47 2015 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java	Mon May 11 13:33:21 2015 +0200
@@ -520,7 +520,16 @@
     }
     htmlExporter.setExporterInput(exporterInput);
     htmlExporter.setExporterOutput(exporterOutput);
-    htmlExporter.exportReport();
+    try {
+      htmlExporter.exportReport();
+    } catch (Exception e) {
+      // Handle the exception to ignore the error thrown when the user closes the browser before
+      // getting the whole HTML report
+      Throwable t = e.getCause();
+      if (t != null && !(t.toString().contains("ClientAbortException"))) {
+        throw new JRException(e.getMessage(), e);
+      }
+    }
   }
 
   /**