Fixed issue 37943: Removed newInstance() deprecation warnings.
authorJavier Armendáriz <javier.armendariz@openbravo.com>
Fri, 09 Mar 2018 14:18:48 +0100
changeset 33673 d526512e5e96
parent 33672 226c41af46d2
child 33674 a3ad3bc6723d
child 33677 1d3ccc92fab6
Fixed issue 37943: Removed newInstance() deprecation warnings.

Class.newInstance() is deprecated from JDK 9. It is replaced by Class.getDeclaredConstructor().newInstance(),
but it has the drawback that this call throws an instance of ReflectiveOperationException that must be taken
into account.
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ImportBankFile.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ExecutePayment.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_MatchingTransaction.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceProperty.java
src-core/src/org/openbravo/base/HttpBaseServlet.java
src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java
src-core/src/org/openbravo/database/ExternalConnectionPool.java
src-core/src/org/openbravo/modulescript/ModuleScriptHandler.java
src-wad/src/org/openbravo/wad/WadUtility.java
src/org/openbravo/authentication/AuthenticationManager.java
src/org/openbravo/base/model/ModelProvider.java
src/org/openbravo/base/model/Reference.java
src/org/openbravo/base/provider/OBProvider.java
src/org/openbravo/costing/CostingServer.java
src/org/openbravo/erpCommon/ad_forms/AcctServer.java
src/org/openbravo/erpCommon/ad_forms/DocAmortization.java
src/org/openbravo/erpCommon/ad_forms/DocBank.java
src/org/openbravo/erpCommon/ad_forms/DocCash.java
src/org/openbravo/erpCommon/ad_forms/DocCostAdjustment.java
src/org/openbravo/erpCommon/ad_forms/DocDPManagement.java
src/org/openbravo/erpCommon/ad_forms/DocDoubtfulDebt.java
src/org/openbravo/erpCommon/ad_forms/DocFINBankStatement.java
src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java
src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java
src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java
src/org/openbravo/erpCommon/ad_forms/DocGLJournal.java
src/org/openbravo/erpCommon/ad_forms/DocInOut.java
src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java
src/org/openbravo/erpCommon/ad_forms/DocInventory.java
src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
src/org/openbravo/erpCommon/ad_forms/DocLCCost.java
src/org/openbravo/erpCommon/ad_forms/DocLandedCost.java
src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java
src/org/openbravo/erpCommon/ad_forms/DocMovement.java
src/org/openbravo/erpCommon/ad_forms/DocOrder.java
src/org/openbravo/erpCommon/ad_forms/DocPayment.java
src/org/openbravo/erpCommon/ad_forms/DocProduction.java
src/org/openbravo/erpCommon/utility/GenericTreeServlet.java
src/org/openbravo/erpCommon/utility/OBMessageUtils.java
src/org/openbravo/scheduling/DefaultJob.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ImportBankFile.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ImportBankFile.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2010-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -67,7 +67,8 @@
       BankFileFormat bff = OBDal.getInstance().get(BankFileFormat.class, strBankFileFormat);
       FIN_BankStatementImport bsi = null;
       try {
-        bsi = (FIN_BankStatementImport) Class.forName(bff.getJavaClassName()).newInstance();
+        bsi = (FIN_BankStatementImport) Class.forName(bff.getJavaClassName())
+            .getDeclaredConstructor().newInstance();
       } catch (Exception e) {
         log4j.error("Error while creating new instance for FIN_BankStatementImport - " + e, e);
       }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ExecutePayment.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ExecutePayment.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2010-2017 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -88,14 +88,16 @@
       else if ("CONSTANT".equals(parameter.getParameterType()))
         dao.getNewPaymentRunParameter(paymentRun, parameter, parameter.getDefaultTextValue());
     try {
-      this.paymentExecutionProcess = (FIN_PaymentExecutionProcess) Class.forName(
-          executionProcess.getJavaClassName()).newInstance();
+      this.paymentExecutionProcess = (FIN_PaymentExecutionProcess) Class
+          .forName(executionProcess.getJavaClassName()).getDeclaredConstructor().newInstance();
     } catch (InstantiationException e) {
       throw new NoExecutionProcessFoundException(e);
     } catch (IllegalAccessException e) {
       throw new NoExecutionProcessFoundException(e);
     } catch (ClassNotFoundException e) {
       throw new NoExecutionProcessFoundException(e);
+    } catch (ReflectiveOperationException e) {
+      throw new NoExecutionProcessFoundException(e);
     }
 
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_MatchingTransaction.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_MatchingTransaction.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2010-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -33,7 +33,8 @@
   public FIN_MatchingTransaction(String _algorithm) throws NoAlgorithmFoundException {
     try {
       if (_algorithm != null && !_algorithm.equals(""))
-        this.algorithm = (FIN_MatchingAlgorithm) Class.forName(_algorithm).newInstance();
+        this.algorithm = (FIN_MatchingAlgorithm) Class.forName(_algorithm).getDeclaredConstructor()
+            .newInstance();
       else
         throw new NoAlgorithmFoundException(
             "No algorithm has been defined to match bank statement lines");
@@ -43,6 +44,8 @@
       throw new NoAlgorithmFoundException(e);
     } catch (ClassNotFoundException e) {
       throw new NoAlgorithmFoundException(e);
+    } catch (ReflectiveOperationException e) {
+      throw new NoAlgorithmFoundException(e);
     }
   }
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java	Fri Mar 09 14:18:48 2018 +0100
@@ -286,7 +286,8 @@
             .forName(className));
       } catch (IllegalArgumentException e) {
         // try with OBClassLoader in case package is excluded by Weld
-        expr = (FilterExpression) OBClassLoader.getInstance().loadClass(className).newInstance();
+        expr = (FilterExpression) OBClassLoader.getInstance().loadClass(className)
+            .getDeclaredConstructor().newInstance();
       }
       return expr.getExpression(requestMap);
     } catch (Exception e) {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Fri Mar 09 14:18:48 2018 +0100
@@ -1484,7 +1484,7 @@
           calloutObject = calloutInstances.get(calloutClassName);
           isCalloutInitialized = true;
         } else {
-          calloutObject = calloutClass.newInstance();
+          calloutObject = calloutClass.getDeclaredConstructor().newInstance();
           calloutInstances.put(calloutClassName, calloutObject);
         }
 
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2009-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -184,7 +184,7 @@
         if (uiDefinition.isActive()) {
           final Class<?> clz = OBClassLoader.getInstance().loadClass(
               uiDefinition.getImplementationClassname());
-          return (UIDefinition) clz.newInstance();
+          return (UIDefinition) clz.getDeclaredConstructor().newInstance();
         }
       }
     }
@@ -194,7 +194,7 @@
     }
     // the default
     log.warn("No user interface definition found for reference " + reference);
-    return StringUIDefinition.class.newInstance();
+    return StringUIDefinition.class.getDeclaredConstructor().newInstance();
   }
 
   private synchronized Map<String, FormatDefinition> setInitializeComputeFormatDefinitions() {
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceProperty.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceProperty.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2010-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -204,7 +204,7 @@
   private static DomainType getDomainType(Reference reference) {
     try {
       final Class<?> clz = OBClassLoader.getInstance().loadClass(reference.getModelImpl());
-      final DomainType domainType = (DomainType) clz.newInstance();
+      final DomainType domainType = (DomainType) clz.getDeclaredConstructor().newInstance();
       // can't be set
       // note for our purpose this not need to be set
       // domainType.setReference(reference);
--- a/src-core/src/org/openbravo/base/HttpBaseServlet.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src-core/src/org/openbravo/base/HttpBaseServlet.java	Fri Mar 09 14:18:48 2018 +0100
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2001-2016 Openbravo S.L.U.
+ * Copyright (C) 2001-2018 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -645,7 +645,7 @@
       parserClassName = "org.apache.xerces.parsers.SAXParser";
     }
     try {
-      return (XMLReader) Class.forName(parserClassName).newInstance();
+      return (XMLReader) Class.forName(parserClassName).getDeclaredConstructor().newInstance();
     } catch (Exception e) {
       throw new ServletException(e);
     }
--- a/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java	Fri Mar 09 14:18:48 2018 +0100
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2010-2016 Openbravo S.L.U.
+ * Copyright (C) 2010-2018 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -86,7 +86,8 @@
       try {
         Class<?> myClass = Class.forName(s);
         if (BuildValidation.class.isAssignableFrom(myClass)) {
-          BuildValidation instance = (BuildValidation) myClass.newInstance();
+          BuildValidation instance = (BuildValidation) myClass.getDeclaredConstructor()
+              .newInstance();
           instance.preExecute(modulesVersionMap);
           errors = instance.getErrors();
         }
--- a/src-core/src/org/openbravo/database/ExternalConnectionPool.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src-core/src/org/openbravo/database/ExternalConnectionPool.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2014-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU 
  * All Rights Reserved. 
  ************************************************************************
  */
@@ -39,16 +39,13 @@
    * @param externalConnectionPoolClassName
    *          The full class name of the external connection pool
    * @return An instance of the external connection pool
-   * @throws InstantiationException
-   * @throws IllegalAccessException
-   * @throws ClassNotFoundException
+   * @throws ReflectiveOperationException
    */
-  public final synchronized static ExternalConnectionPool getInstance(
-      String externalConnectionPoolClassName) throws InstantiationException,
-      IllegalAccessException, ClassNotFoundException {
+  public static final synchronized ExternalConnectionPool getInstance(
+      String externalConnectionPoolClassName) throws ReflectiveOperationException {
     if (instance == null) {
       instance = (ExternalConnectionPool) Class.forName(externalConnectionPoolClassName)
-          .newInstance();
+          .getDeclaredConstructor().newInstance();
     }
     return instance;
   }
--- a/src-core/src/org/openbravo/modulescript/ModuleScriptHandler.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src-core/src/org/openbravo/modulescript/ModuleScriptHandler.java	Fri Mar 09 14:18:48 2018 +0100
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2010-2015 Openbravo S.L.U.
+ * Copyright (C) 2010-2018 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -60,7 +60,7 @@
       try {
         Class<?> myClass = Class.forName(s);
         if (ModuleScript.class.isAssignableFrom(myClass)) {
-          ModuleScript instance = (ModuleScript) myClass.newInstance();
+          ModuleScript instance = (ModuleScript) myClass.getDeclaredConstructor().newInstance();
           instance.preExecute(getModulesVersionMap());
         }
       } catch (Exception e) {
--- a/src-wad/src/org/openbravo/wad/WadUtility.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src-wad/src/org/openbravo/wad/WadUtility.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -22,6 +22,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
+import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -442,7 +443,7 @@
     } else {
       try {
         Class<?> c = Class.forName(classname);
-        control = (WADControl) c.newInstance();
+        control = (WADControl) c.getDeclaredConstructor().newInstance();
         control.setReference(parentRef);
         control.setSubreference(subRef);
       } catch (ClassNotFoundException ex) {
@@ -455,6 +456,12 @@
       } catch (IllegalAccessException e) {
         log4j.warn("Illegal access class: " + classname);
         control = new WADControl();
+      } catch (InvocationTargetException e) {
+        log4j.warn("Exception thrown by default constructor of class: " + classname);
+        control = new WADControl();
+      } catch (NoSuchMethodException e) {
+        log4j.warn("Could not find a default constructor for class: " + classname);
+        control = new WADControl();
       }
     }
     return control;
--- a/src/org/openbravo/authentication/AuthenticationManager.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/authentication/AuthenticationManager.java	Fri Mar 09 14:18:48 2018 +0100
@@ -112,7 +112,7 @@
     }
     try {
       authManager = (AuthenticationManager) OBClassLoader.getInstance().loadClass(authClass)
-          .newInstance();
+          .getDeclaredConstructor().newInstance();
       authManager.init(s);
     } catch (Exception e) {
       log4j
--- a/src/org/openbravo/base/model/ModelProvider.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/base/model/ModelProvider.java	Fri Mar 09 14:18:48 2018 +0100
@@ -368,7 +368,8 @@
           String classname = rs.getString(1);
           Class<?> myClass = Class.forName(classname);
           if (org.openbravo.base.model.domaintype.BaseDomainType.class.isAssignableFrom(myClass)) {
-            BaseDomainType classInstance = (BaseDomainType) myClass.newInstance();
+            BaseDomainType classInstance = (BaseDomainType) myClass.getDeclaredConstructor()
+                .newInstance();
             for (Class<?> aClass : classInstance.getClasses()) {
               sessionFactoryController.addAdditionalClasses(aClass);
             }
--- a/src/org/openbravo/base/model/Reference.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/base/model/Reference.java	Fri Mar 09 14:18:48 2018 +0100
@@ -106,7 +106,7 @@
     }
     try {
       final Class<?> clz = OBClassLoader.getInstance().loadClass(modelImplementationClass);
-      domainType = (DomainType) clz.newInstance();
+      domainType = (DomainType) clz.getDeclaredConstructor().newInstance();
       domainType.setReference(this);
     } catch (Exception e) {
       throw new OBException("Not able to create domain type " + getModelImpl() + " for reference "
--- a/src/org/openbravo/base/provider/OBProvider.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/base/provider/OBProvider.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -241,7 +241,7 @@
 
       // instantiate the class
       try {
-        final Object value = instanceClass.newInstance();
+        final Object value = instanceClass.getDeclaredConstructor().newInstance();
         if (singleton) {
           theInstance = value;
         }
--- a/src/org/openbravo/costing/CostingServer.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/costing/CostingServer.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2012-2017 Openbravo SLU
+ * All portions are Copyright (C) 2012-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -497,7 +497,7 @@
 
     try {
       final Class<?> clz = OBClassLoader.getInstance().loadClass(costAlgorithm.getJavaClassName());
-      CostingAlgorithm algorithm = (CostingAlgorithm) clz.newInstance();
+      CostingAlgorithm algorithm = (CostingAlgorithm) clz.getDeclaredConstructor().newInstance();
       algorithm.init(this);
       return algorithm;
     } catch (Exception e) {
--- a/src/org/openbravo/erpCommon/ad_forms/AcctServer.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/AcctServer.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2017 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -611,7 +611,8 @@
       if (acctinfo != null && acctinfo.length != 0) {
         if (!acctinfo[0].acctclassname.equals("") && !acctinfo[0].acctdatecolumn.equals("")) {
           try {
-            acct = (AcctServer) Class.forName(acctinfo[0].acctclassname).newInstance();
+            acct = (AcctServer) Class.forName(acctinfo[0].acctclassname).getDeclaredConstructor()
+                .newInstance();
             acct.set(AD_Table_ID, AD_Client_ID, AD_Org_ID, connectionProvider,
                 acctinfo[0].tablename, acctinfo[0].acctdatecolumn);
             acct.reloadAcctSchemaArray();
@@ -1172,7 +1173,7 @@
       if (!strClassname.equals("")) {
         try {
           AcctProcessTemplate newTemplate = (AcctProcessTemplate) Class.forName(strClassname)
-              .newInstance();
+              .getDeclaredConstructor().newInstance();
           if (!newTemplate.execute(this, as, conn, con, vars)) {
             OBDal.getInstance().rollbackAndClose();
             return getStatus();
@@ -2543,8 +2544,8 @@
     amtDiff = amtDiff.add(calculateMultipleRatesDifferences(_amount, currencyIDFrom, currencyIDTo,
         line, conn));
     Currency currencyTo = OBDal.getInstance().get(Currency.class, currencyIDTo);
-    amtDiff = amtDiff.setScale(currencyTo.getStandardPrecision().intValue(),
-        RoundingMode.HALF_EVEN);
+    amtDiff = amtDiff
+        .setScale(currencyTo.getStandardPrecision().intValue(), RoundingMode.HALF_EVEN);
     if (bookDifferences) {
       if ((!isReceipt && amtDiff.compareTo(BigDecimal.ZERO) == 1)
           || (isReceipt && amtDiff.compareTo(BigDecimal.ZERO) == -1)) {
--- a/src/org/openbravo/erpCommon/ad_forms/DocAmortization.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocAmortization.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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-2010 Openbravo SLU
+ * All portions are Copyright (C) 2001-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -184,7 +184,7 @@
     if (!strClassname.equals("")) {
       try {
         DocAmortizationTemplate newTemplate = (DocAmortizationTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocAmortizationTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocBank.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocBank.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2010 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -220,7 +220,8 @@
       strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID);
     if (!strClassname.equals("")) {
       try {
-        DocBankTemplate newTemplate = (DocBankTemplate) Class.forName(strClassname).newInstance();
+        DocBankTemplate newTemplate = (DocBankTemplate) Class.forName(strClassname)
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocBankTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocCash.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocCash.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2010 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -237,7 +237,8 @@
       strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID);
     if (!strClassname.equals("")) {
       try {
-        DocCashTemplate newTemplate = (DocCashTemplate) Class.forName(strClassname).newInstance();
+        DocCashTemplate newTemplate = (DocCashTemplate) Class.forName(strClassname)
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocCashTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocCostAdjustment.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocCostAdjustment.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2014-2015 Openbravo SLU
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -54,8 +54,8 @@
     super(AD_Client_ID, AD_Org_ID, connectionProvider);
   }
 
-  public void loadObjectFieldProvider(ConnectionProvider conn, @SuppressWarnings("hiding")
-  String AD_Client_ID, String Id) throws ServletException {
+  public void loadObjectFieldProvider(ConnectionProvider conn,
+      @SuppressWarnings("hiding") String AD_Client_ID, String Id) throws ServletException {
     setObjectFieldProvider(DocCostAdjustmentData.selectRegistro(conn, AD_Client_ID, Id));
   }
 
@@ -151,8 +151,8 @@
       strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID);
     } else {
       try {
-        DocCostAdjustmentTemplate newTemplate = (DocCostAdjustmentTemplate) Class.forName(
-            strClassname).newInstance();
+        DocCostAdjustmentTemplate newTemplate = (DocCostAdjustmentTemplate) Class
+            .forName(strClassname).getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocCostAdjustmentTemplate - ", e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocDPManagement.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocDPManagement.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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-2010 Openbravo SLU
+ * All portions are Copyright (C) 2001-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -171,7 +171,7 @@
     if (!strClassname.equals("")) {
       try {
         DocDPManagementTemplate newTemplate = (DocDPManagementTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         docDPManagementLog4j
--- a/src/org/openbravo/erpCommon/ad_forms/DocDoubtfulDebt.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocDoubtfulDebt.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2013-2014 Openbravo SLU
+ * All portions are Copyright (C) 2013-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -147,8 +147,8 @@
       }
       if (!strClassname.equals("")) {
         try {
-          DocDoubtfulDebtTemplate newTemplate = (DocDoubtfulDebtTemplate) Class.forName(
-              strClassname).newInstance();
+          DocDoubtfulDebtTemplate newTemplate = (DocDoubtfulDebtTemplate) Class
+              .forName(strClassname).getDeclaredConstructor().newInstance();
           return newTemplate.createFact(this, as, conn, con, vars);
         } catch (Exception e) {
           log4j.error("Error while creating new instance for DocUnbilledRevenueTemplate - ", e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINBankStatement.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINBankStatement.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2010-2014 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -116,8 +116,8 @@
       }
       if (!strClassname.equals("")) {
         try {
-          DocFINBankStatementTemplate newTemplate = (DocFINBankStatementTemplate) Class.forName(
-              strClassname).newInstance();
+          DocFINBankStatementTemplate newTemplate = (DocFINBankStatementTemplate) Class
+              .forName(strClassname).getDeclaredConstructor().newInstance();
           return newTemplate.createFact(this, as, conn, con, vars);
         } catch (Exception e) {
           log4j.error("Error while creating new instance for DocFINBankStatementTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2010-2017 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -454,7 +454,7 @@
       if (!strClassname.equals("")) {
         try {
           DocFINFinAccTransactionTemplate newTemplate = (DocFINFinAccTransactionTemplate) Class
-              .forName(strClassname).newInstance();
+              .forName(strClassname).getDeclaredConstructor().newInstance();
           return newTemplate.createFact(this, as, conn, con, vars);
         } catch (Exception e) {
           docFINFinAccTransactionLog4j
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2010-2017 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -368,7 +368,7 @@
       if (!strClassname.equals("")) {
         try {
           DocFINPaymentTemplate newTemplate = (DocFINPaymentTemplate) Class.forName(strClassname)
-              .newInstance();
+              .getDeclaredConstructor().newInstance();
           return newTemplate.createFact(this, as, conn, con, vars);
         } catch (Exception e) {
           docFINPaymentLog4j.error(
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2010-2017 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -585,8 +585,8 @@
       }
       if (!strClassname.equals("")) {
         try {
-          DocFINReconciliationTemplate newTemplate = (DocFINReconciliationTemplate) Class.forName(
-              strClassname).newInstance();
+          DocFINReconciliationTemplate newTemplate = (DocFINReconciliationTemplate) Class
+              .forName(strClassname).getDeclaredConstructor().newInstance();
           return newTemplate.createFact(this, as, conn, con, vars);
         } catch (Exception e) {
           docFINReconciliationLog4j
--- a/src/org/openbravo/erpCommon/ad_forms/DocGLJournal.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocGLJournal.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2017 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -170,7 +170,7 @@
     if (!strClassname.equals("")) {
       try {
         DocGLJournalTemplate newTemplate = (DocGLJournalTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocGLJournalTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocInOut.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInOut.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2017 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -171,7 +171,8 @@
       strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID);
     if (!strClassname.equals("")) {
       try {
-        DocInOutTemplate newTemplate = (DocInOutTemplate) Class.forName(strClassname).newInstance();
+        DocInOutTemplate newTemplate = (DocInOutTemplate) Class.forName(strClassname)
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocInOutTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2014 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2014-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -162,7 +162,7 @@
     } else {
       try {
         DocInternalConsumptionTemplate newTemplate = (DocInternalConsumptionTemplate) Class
-            .forName(strClassname).newInstance();
+            .forName(strClassname).getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocInternalConsumptionTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocInventory.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInventory.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2016 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -159,7 +159,7 @@
     if (!strClassname.equals("")) {
       try {
         DocInventoryTemplate newTemplate = (DocInventoryTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocInventoryTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2017 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -142,8 +142,8 @@
       // Accruals & Deferrals for revenue products
       docLine.setIsDeferred("Y".equals(data[i].isdeferred));
       docLine.setDefPlanType(data[i].defplantype);
-      docLine.setPeriodNumber(!"".equals(data[i].periodnumber) ? Integer.parseInt(data[i].periodnumber)
-          : 0);
+      docLine.setPeriodNumber(!"".equals(data[i].periodnumber) ? Integer
+          .parseInt(data[i].periodnumber) : 0);
       docLine.setStartingPeriodId(data[i].cPeriodId);
 
       list.add(docLine);
@@ -302,7 +302,7 @@
     if (!strClassname.equals("")) {
       try {
         DocInvoiceTemplate newTemplate = (DocInvoiceTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocInvoiceTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocLCCost.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLCCost.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2014-2015 Openbravo SLU
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -60,8 +60,8 @@
     super(AD_Client_ID, AD_Org_ID, connectionProvider);
   }
 
-  public void loadObjectFieldProvider(ConnectionProvider conn, @SuppressWarnings("hiding")
-  String AD_Client_ID, String Id) throws ServletException {
+  public void loadObjectFieldProvider(ConnectionProvider conn,
+      @SuppressWarnings("hiding") String AD_Client_ID, String Id) throws ServletException {
     setObjectFieldProvider(DocLCCostData.selectRegistro(conn, AD_Client_ID, Id));
   }
 
@@ -167,7 +167,7 @@
     if (!strClassname.equals("")) {
       try {
         DocLCCostTemplate newTemplate = (DocLCCostTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocLCCostTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocLandedCost.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocLandedCost.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2014-2015 Openbravo SLU
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -55,8 +55,8 @@
     super(AD_Client_ID, AD_Org_ID, connectionProvider);
   }
 
-  public void loadObjectFieldProvider(ConnectionProvider conn, @SuppressWarnings("hiding")
-  String AD_Client_ID, String Id) throws ServletException {
+  public void loadObjectFieldProvider(ConnectionProvider conn,
+      @SuppressWarnings("hiding") String AD_Client_ID, String Id) throws ServletException {
     setObjectFieldProvider(DocLandedCostData.selectRegistro(conn, AD_Client_ID, Id));
   }
 
@@ -159,7 +159,7 @@
     if (!strClassname.equals("")) {
       try {
         DocLandedCostTemplate newTemplate = (DocLandedCostTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocLandedCostTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocMatchInv.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2017 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -66,8 +66,8 @@
     super(AD_Client_ID, AD_Org_ID, connectionProvider);
   }
 
-  public void loadObjectFieldProvider(ConnectionProvider conn, @SuppressWarnings("hiding")
-  String AD_Client_ID, String Id) throws ServletException {
+  public void loadObjectFieldProvider(ConnectionProvider conn,
+      @SuppressWarnings("hiding") String AD_Client_ID, String Id) throws ServletException {
     setObjectFieldProvider(DocMatchInvData.selectRegistro(conn, AD_Client_ID, Id));
   }
 
@@ -206,7 +206,7 @@
     if (!strClassname.equals("")) {
       try {
         DocMatchInvTemplate newTemplate = (DocMatchInvTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocMatchInvTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocMovement.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocMovement.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2017 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -152,7 +152,7 @@
     if (!strClassname.equals("")) {
       try {
         DocMovementTemplate newTemplate = (DocMovementTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocInvoiceTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocOrder.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocOrder.java	Fri Mar 09 14:18:48 2018 +0100
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2010 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2018 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -196,7 +196,8 @@
       strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID);
     if (!strClassname.equals("")) {
       try {
-        DocOrderTemplate newTemplate = (DocOrderTemplate) Class.forName(strClassname).newInstance();
+        DocOrderTemplate newTemplate = (DocOrderTemplate) Class.forName(strClassname)
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4j.error("Error while creating new instance for DocOrderTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocPayment.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocPayment.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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-2010 Openbravo SLU
+ * All portions are Copyright (C) 2001-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -163,7 +163,7 @@
     if (!strClassname.equals("")) {
       try {
         DocPaymentTemplate newTemplate = (DocPaymentTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         docPaymentLog4j.error("Error while creating new instance for DocPaymentTemplate - " + e);
--- a/src/org/openbravo/erpCommon/ad_forms/DocProduction.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocProduction.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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-2015 Openbravo SLU
+ * All portions are Copyright (C) 2008-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -155,7 +155,7 @@
     if (!strClassname.equals("")) {
       try {
         DocProductionTemplate newTemplate = (DocProductionTemplate) Class.forName(strClassname)
-            .newInstance();
+            .getDeclaredConstructor().newInstance();
         return newTemplate.createFact(this, as, conn, con, vars);
       } catch (Exception e) {
         log4jDocProduction.error("Error while creating new instance for DocProductionTemplate - "
--- a/src/org/openbravo/erpCommon/utility/GenericTreeServlet.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/utility/GenericTreeServlet.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -86,7 +86,8 @@
     String htmlTree = "";
     try {
       String newLevel = Integer.valueOf(Integer.valueOf(level).intValue() + 1).toString();
-      GenericTree tree = (GenericTree) Class.forName(treeClass).newInstance();
+      GenericTree tree = (GenericTree) Class.forName(treeClass).getDeclaredConstructor()
+          .newInstance();
       tree.setParameters(this);
       tree.setLanguage(vars.getLanguage());
       tree.setSubTree(strNodeId, newLevel);
@@ -120,7 +121,8 @@
     PrintWriter out = response.getWriter();
 
     try {
-      GenericTree tree = (GenericTree) Class.forName(treeClass).newInstance();
+      GenericTree tree = (GenericTree) Class.forName(treeClass).getDeclaredConstructor()
+          .newInstance();
       tree.setParameters(this);
       tree.setLanguage(vars.getLanguage());
       description = tree.getHTMLDescription(strNodeId);
--- a/src/org/openbravo/erpCommon/utility/OBMessageUtils.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/erpCommon/utility/OBMessageUtils.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2012-2017 Openbravo SLU
+ * All portions are Copyright (C) 2012-2018 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -159,13 +159,13 @@
 
   /**
    * 
-   * Formats a message String into a String for html presentation. Escapes the &amp;, &lt;, &gt;, " and ®, and
-   * replace the \n by <br/>
+   * Formats a message String into a String for html presentation. Escapes the &amp;, &lt;, &gt;, "
+   * and ®, and replace the \n by <br/>
    * and \r for space.
    * 
    * IMPORTANT! : this method is designed to transform the output of Utility.messageBD method, and
-   * this method replaces \n by \\n and \" by &amp;quote. Because of that, the first replacements revert
-   * this previous replacements.
+   * this method replaces \n by \\n and \" by &amp;quote. Because of that, the first replacements
+   * revert this previous replacements.
    * 
    * @param message
    *          message with java formating
@@ -429,7 +429,7 @@
       try {
         final Class<?> c = Class.forName("org.openbravo.erpCommon.utility.ErrorTextParser"
             + rdbms.toUpperCase());
-        myParser = (ErrorTextParser) c.newInstance();
+        myParser = (ErrorTextParser) c.getDeclaredConstructor().newInstance();
       } catch (final ClassNotFoundException ex) {
         log4j.warn("Couldn´t find class: org.openbravo.erpCommon.utility.ErrorTextParser"
             + rdbms.toUpperCase());
--- a/src/org/openbravo/scheduling/DefaultJob.java	Fri Mar 09 15:28:54 2018 +0100
+++ b/src/org/openbravo/scheduling/DefaultJob.java	Fri Mar 09 14:18:48 2018 +0100
@@ -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) 2009-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -48,7 +48,7 @@
   public void execute(JobExecutionContext jec) throws JobExecutionException {
     bundle = (ProcessBundle) jec.getMergedJobDataMap().get(ProcessBundle.KEY);
     try {
-      processInstance = bundle.getProcessClass().newInstance();
+      processInstance = bundle.getProcessClass().getDeclaredConstructor().newInstance();
       bundle.setConnection((ConnectionProvider) jec.get(ProcessBundle.CONNECTION));
       bundle.setConfig((ConfigParameters) jec.get(ProcessBundle.CONFIG_PARAMS));
       bundle.setLog(new ProcessLogger(bundle.getConnection()));