Fixes ISSUE-44863: Remove never thrown ServletException in OBScheduler methods default tip
authorCristian Berner <cristian.berner@openbravo.com>
Mon, 31 Aug 2020 12:03:00 +0200
changeset 37516 743260848809
parent 37515 45d74fc33c46
Fixes ISSUE 44863: Remove never thrown ServletException in OBScheduler methods

OBScheduler has been modified previously when quartz has been updated,
but reschedule and unschedule method declarations have not been updated.
ServletException is not thrown anymore in those methods, so it has been
removed from there.

Catch blocks that were catching this non-thrown exception have also been
removed in CallAcctServer and UnscheduleProcess classes.
src/org/openbravo/erpCommon/ad_forms/CallAcctServer.java
src/org/openbravo/erpCommon/ad_process/UnscheduleProcess.java
src/org/openbravo/scheduling/OBScheduler.java
--- a/src/org/openbravo/erpCommon/ad_forms/CallAcctServer.java	Fri Aug 21 14:19:34 2020 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/CallAcctServer.java	Mon Aug 31 12:03:00 2020 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2013 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2020 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -41,7 +41,6 @@
 import org.openbravo.scheduling.ProcessContext;
 import org.openbravo.scheduling.ProcessRunner;
 import org.openbravo.xmlEngine.XmlDocument;
-import org.quartz.SchedulerException;
 
 public class CallAcctServer extends HttpSecureAppServlet {
   private static final long serialVersionUID = 1L;
@@ -67,11 +66,7 @@
       String strDateFrom = vars.getStringParameter("inpDateFrom");
       String strDateTo = vars.getStringParameter("inpDateTo");
       if (data.length > 0 && data[0].status.equals(org.openbravo.scheduling.Process.SCHEDULED)) {
-        try {
-          OBScheduler.getInstance().unschedule(data[0].id, new ProcessContext(vars));
-        } catch (SchedulerException e) {
-          throw new ServletException(e.getMessage(), e);
-        }
+        OBScheduler.getInstance().unschedule(data[0].id, new ProcessContext(vars));
       }
       // acctServer.cancelDirectProcess();
       printPage(response, vars, strTableId, strAdOrgId, "", strDateFrom, strDateTo);
--- a/src/org/openbravo/erpCommon/ad_process/UnscheduleProcess.java	Fri Aug 21 14:19:34 2020 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/UnscheduleProcess.java	Mon Aug 31 12:03:00 2020 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008-2013 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2020 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -33,7 +33,6 @@
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.scheduling.OBScheduler;
 import org.openbravo.scheduling.ProcessContext;
-import org.quartz.SchedulerException;
 
 public class UnscheduleProcess extends HttpSecureAppServlet {
 
@@ -60,16 +59,8 @@
 
     final String windowId = vars.getStringParameter("inpwindowId");
     final String requestId = vars.getSessionValue(windowId + "|" + PROCESS_REQUEST_ID);
-    String message;
-    try {
-      OBScheduler.getInstance().unschedule(requestId, new ProcessContext(vars));
-
-    } catch (final SchedulerException e) {
-      message = Utility.messageBD(this, "UNSCHED_ERROR", vars.getLanguage());
-      String processErrorTit = Utility.messageBD(this, "Error", vars.getLanguage());
-      advisePopUp(request, response, "ERROR", processErrorTit, message + " " + e.getMessage());
-    }
-    message = Utility.messageBD(this, "UNSCHED_SUCCESS", vars.getLanguage());
+    OBScheduler.getInstance().unschedule(requestId, new ProcessContext(vars));
+    String message = Utility.messageBD(this, "UNSCHED_SUCCESS", vars.getLanguage());
     String processTitle = Utility.messageBD(this, "Success", vars.getLanguage());
     advisePopUpRefresh(request, response, "SUCCESS", processTitle, message);
   }
--- a/src/org/openbravo/scheduling/OBScheduler.java	Fri Aug 21 14:19:34 2020 +0200
+++ b/src/org/openbravo/scheduling/OBScheduler.java	Mon Aug 31 12:03:00 2020 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008-2019 Openbravo SLU
+ * All portions are Copyright (C) 2008-2020 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -182,10 +182,8 @@
    * @param requestId
    * @param bundle
    * @throws SchedulerException
-   * @throws ServletException
    */
-  public void reschedule(String requestId, ProcessBundle bundle)
-      throws SchedulerException, ServletException {
+  public void reschedule(String requestId, ProcessBundle bundle) throws SchedulerException {
     try {
       sched.unscheduleJob(triggerKey(requestId, OB_GROUP));
       sched.deleteJob(jobKey(requestId, OB_GROUP));
@@ -196,7 +194,7 @@
     schedule(requestId, bundle);
   }
 
-  public void unschedule(String requestId, ProcessContext context) throws SchedulerException {
+  public void unschedule(String requestId, ProcessContext context) {
     try {
       sched.unscheduleJob(triggerKey(requestId, OB_GROUP));
       sched.deleteJob(jobKey(requestId, OB_GROUP));