Author: deepak
Date: Sun Mar 3 10:27:29 2019 New Revision: 1854683 URL: http://svn.apache.org/viewvc?rev=1854683&view=rev Log: Preparation for JDK11 update, Updated code to fix following warning with respect to JDK11 - Replaced Class::newInstance method occurrences - Removed deprecated override method Object::finalize Modified: ofbiz/ofbiz-framework/trunk/build.gradle ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/ConnectionFactoryLoader.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionFactoryLoader.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/StandardJavaEngine.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetContentWorker.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetDataResourceWorker.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java Modified: ofbiz/ofbiz-framework/trunk/build.gradle URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/build.gradle?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/build.gradle (original) +++ ofbiz/ofbiz-framework/trunk/build.gradle Sun Mar 3 10:27:29 2019 @@ -180,6 +180,7 @@ dependencies { testCompile 'org.mockito:mockito-core:2.23.0' // ofbiz runtime libs + runtime 'javax.xml.soap:javax.xml.soap-api:1.4.0' runtime 'de.odysseus.juel:juel-spi:2.2.7' runtime 'net.sf.barcode4j:barcode4j-fop-ext:2.1' runtime 'net.sf.barcode4j:barcode4j:2.1' Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java Sun Mar 3 10:27:29 2019 @@ -154,10 +154,10 @@ public abstract class ResourceLoader { Class<?> lClass = null; ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); lClass = classLoader.loadClass(className); - loader = (ResourceLoader) lClass.newInstance(); + loader = (ResourceLoader) lClass.getDeclaredConstructor().newInstance(); loader.init(loaderName, loaderElement.getAttribute("prefix"), loaderElement.getAttribute("prepend-env")); return loader; - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { + } catch (ReflectiveOperationException e) { throw new GenericConfigException("Exception thrown while loading ResourceLoader class \"" + className + "\" ", e); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java Sun Mar 3 10:27:29 2019 @@ -131,8 +131,8 @@ public class ContainerLoader { // create a new instance of the container object Container containerObj; try { - containerObj = (Container) containerClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { + containerObj = (Container) containerClass.getDeclaredConstructor().newInstance(); + } catch (ReflectiveOperationException e) { throw new StartupException("Cannot create " + containerCfg.name, e); } if (containerObj == null) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java Sun Mar 3 10:27:29 2019 @@ -62,7 +62,7 @@ public final class FlexibleLocation { String locationType = (String) entry.getKey(); String locationResolverName = (String) entry.getValue(); Class<?> lClass = classLoader.loadClass(locationResolverName); - resolverMap.put(locationType, (LocationResolver) lClass.newInstance()); + resolverMap.put(locationType, (LocationResolver) lClass.getDeclaredConstructor().newInstance()); } } } catch (Throwable e) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java Sun Mar 3 10:27:29 2019 @@ -19,6 +19,7 @@ package org.apache.ofbiz.base.util; import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -154,11 +155,13 @@ public class ObjectType { * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException + * @throws NoSuchMethodException + * @throws InvocationTargetException, */ - public static Object getInstance(String className) throws ClassNotFoundException, - InstantiationException, IllegalAccessException { + public static Object getInstance(String className) throws ClassNotFoundException, InstantiationException, + IllegalAccessException, NoSuchMethodException, InvocationTargetException { Class<?> c = loadClass(className); - Object o = c.newInstance(); + Object o = c.getDeclaredConstructor().newInstance(); if (Debug.verboseOn()) { Debug.logVerbose("Instantiated object: " + o.toString(), module); Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java Sun Mar 3 10:27:29 2019 @@ -39,12 +39,4 @@ public abstract class CacheSoftReference } super.clear(); } - - @Override - protected void finalize() throws Throwable { - if (Debug.verboseOn()) { - Debug.logVerbose(new Exception("UtilCache.CacheSoftRef.finalize()"), "Finalize UtilCache SoftReference - " + get(), module); - } - super.finalize(); - } } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java Sun Mar 3 10:27:29 2019 @@ -146,7 +146,7 @@ public final class FreeMarkerWorker { Debug.logVerbose("Adding FTL Transform " + key + " with class " + className, module); } try { - config.setSharedVariable(key, loader.loadClass(className).newInstance()); + config.setSharedVariable(key, loader.loadClass(className).getDeclaredConstructor().newInstance()); } catch (Exception e) { Debug.logError(e, "Could not pre-initialize dynamically loaded class: " + className + ": " + e, module); } Modified: ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java Sun Mar 3 10:27:29 2019 @@ -310,7 +310,7 @@ public class CatalinaContainer implement ReplicationTransmitter trans = new ReplicationTransmitter(); try { MultiPointSender mps = (MultiPointSender)Class.forName(ContainerConfig.getPropertyValue(clusterProp, - "replication-mode", "org.apache.catalina.tribes.transport.bio.PooledMultiSender")).newInstance(); + "replication-mode", "org.apache.catalina.tribes.transport.bio.PooledMultiSender")).getDeclaredConstructor().newInstance(); trans.setTransport(mps); } catch (Exception exc) { throw new ContainerException("Cluster configuration requires a valid replication-mode property: " + exc.getMessage()); @@ -346,8 +346,8 @@ public class CatalinaContainer implement private ClusterManager prepareClusterManager(Property clusterProp) throws ContainerException { String mgrClassName = ContainerConfig.getPropertyValue(clusterProp, "manager-class", "org.apache.catalina.ha.session.DeltaManager"); try { - return (ClusterManager)Class.forName(mgrClassName).newInstance(); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + return (ClusterManager)Class.forName(mgrClassName).getDeclaredConstructor().newInstance(); + } catch (ReflectiveOperationException e) { throw new ContainerException("Cluster configuration requires a valid manager-class property", e); } } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java Sun Mar 3 10:27:29 2019 @@ -327,15 +327,11 @@ public class GenericDelegator implements try { Class<?> eecahClass = loader.loadClass(entityEcaHandlerClassName); - EntityEcaHandler<?> entityEcaHandler = UtilGenerics.cast(eecahClass.newInstance()); + EntityEcaHandler<?> entityEcaHandler = UtilGenerics.cast(eecahClass.getDeclaredConstructor().newInstance()); entityEcaHandler.setDelegator(this); return entityEcaHandler; - } catch (ClassNotFoundException e) { + } catch (ReflectiveOperationException e) { Debug.logWarning(e, "EntityEcaHandler class with name " + entityEcaHandlerClassName + " was not found, Entity ECA Rules will be disabled", module); - } catch (InstantiationException e) { - Debug.logWarning(e, "EntityEcaHandler class with name " + entityEcaHandlerClassName + " could not be instantiated, Entity ECA Rules will be disabled", module); - } catch (IllegalAccessException e) { - Debug.logWarning(e, "EntityEcaHandler class with name " + entityEcaHandlerClassName + " could not be accessed (illegal), Entity ECA Rules will be disabled", module); } catch (ClassCastException e) { Debug.logWarning(e, "EntityEcaHandler class with name " + entityEcaHandlerClassName + " does not implement the EntityEcaHandler interface, Entity ECA Rules will be disabled", module); } @@ -2609,15 +2605,11 @@ public class GenericDelegator implements try { Class<?> dccClass = loader.loadClass(distributedCacheClearClassName); - DistributedCacheClear distributedCacheClear = UtilGenerics.cast(dccClass.newInstance()); + DistributedCacheClear distributedCacheClear = UtilGenerics.cast(dccClass.getDeclaredConstructor().newInstance()); distributedCacheClear.setDelegator(this, this.delegatorInfo.getDistributedCacheClearUserLoginId()); return distributedCacheClear; - } catch (ClassNotFoundException e) { + } catch (ReflectiveOperationException e) { Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " was not found, distributed cache clearing will be disabled", module); - } catch (InstantiationException e) { - Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " could not be instantiated, distributed cache clearing will be disabled", module); - } catch (IllegalAccessException e) { - Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " could not be accessed (illegal), distributed cache clearing will be disabled", module); } catch (ClassCastException e) { Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " does not implement the DistributedCacheClear interface, distributed cache clearing will be disabled", module); } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java Sun Mar 3 10:27:29 2019 @@ -88,7 +88,7 @@ public class DBCPConnectionFactory imple synchronized (DBCPConnectionFactory.class) { // Sync needed for MS SQL JDBC driver. See OFBIZ-5216. try { - jdbcDriver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).newInstance(); + jdbcDriver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).getDeclaredConstructor().newInstance(); } catch (Exception e) { Debug.logError(e, module); throw new GenericEntityException(e.getMessage(), e); Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/ConnectionFactoryLoader.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/ConnectionFactoryLoader.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/ConnectionFactoryLoader.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/ConnectionFactoryLoader.java Sun Mar 3 10:27:29 2019 @@ -43,7 +43,7 @@ public class ConnectionFactoryLoader { } ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class<?> tfClass = loader.loadClass(className); - instance = (ConnectionFactory) tfClass.newInstance(); + instance = (ConnectionFactory) tfClass.getDeclaredConstructor().newInstance(); } catch (ClassNotFoundException cnfe) { Debug.logError(cnfe, "Could not find connection factory class", module); } catch (Exception e) { Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java Sun Mar 3 10:27:29 2019 @@ -116,14 +116,10 @@ public class DatabaseUtil { if (driverName != null) { if (DriverManager.getDriver(driverName) == null) { try { - Driver driver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).newInstance(); + Driver driver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).getDeclaredConstructor().newInstance(); DriverManager.registerDriver(driver); - } catch (ClassNotFoundException e) { + } catch (ReflectiveOperationException e) { Debug.logWarning(e, "Unable to load driver [" + driverName + "]", module); - } catch (InstantiationException e) { - Debug.logWarning(e, "Unable to instantiate driver [" + driverName + "]", module); - } catch (IllegalAccessException e) { - Debug.logWarning(e, "Illegal access exception [" + driverName + "]", module); } } } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java Sun Mar 3 10:27:29 2019 @@ -829,16 +829,6 @@ public class SQLProcessor implements Aut _ind++; } - @Override - protected void finalize() throws Throwable { - try { - this.close(); - } catch (Exception e) { - Debug.logError(e, "Error closing the result, connection, etc in finalize SQLProcessor", module); - } - super.finalize(); - } - protected void testConnection(Connection con) throws GenericEntityException { if (SQLProcessor.ENABLE_TEST) { if (SQLProcessor.CONNECTION_TEST_LIST.contains(con.toString())) { Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionFactoryLoader.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionFactoryLoader.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionFactoryLoader.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/transaction/TransactionFactoryLoader.java Sun Mar 3 10:27:29 2019 @@ -39,7 +39,7 @@ public class TransactionFactoryLoader { } ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class<?> tfClass = loader.loadClass(className); - instance = (TransactionFactory) tfClass.newInstance(); + instance = (TransactionFactory) tfClass.getDeclaredConstructor().newInstance(); } catch (GenericEntityConfException gece) { Debug.logError(gece, "Could not find transaction factory class name definition", module); } catch (ClassNotFoundException cnfe) { Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityListIterator.java Sun Mar 3 10:27:29 2019 @@ -526,27 +526,6 @@ public class EntityListIterator implemen } /** - * Extends {@link Object#finalize()} to make sure that the {@link EntityListIterator} is closed when it is garbage collected. - * - * {@inheritDoc} - */ - @Override - protected void finalize() throws Throwable { - try { - if (!closed) { - this.close(); - Debug.logError("\n==============================================================================\n" - + "EntityListIterator Not Closed for Entity [%s], caught in Finalize\n" - + "\n==============================================================================\n", - module, modelEntity == null ? "" : modelEntity.getEntityName()); - } - } catch (Exception e) { - Debug.logError(e, "Error closing the SQLProcessor in finalize EntityListIterator", module); - } - super.finalize(); - } - - /** * Closes the {@link EntityListIterator} and logs a warning if it isn't already closed. * * If you don't want to handle the {@link GenericEntityException} thrown by {@link #close()}, use {@link #tryCloseWithWarning()}. Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ServiceContainer.java Sun Mar 3 10:27:29 2019 @@ -54,7 +54,7 @@ public class ServiceContainer implements ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { Class<?> c = loader.loadClass(dispatcherFactoryProperty.value); - dispatcherFactory = (LocalDispatcherFactory) c.newInstance(); + dispatcherFactory = (LocalDispatcherFactory) c.getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new ContainerException(e); } Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/StandardJavaEngine.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/StandardJavaEngine.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/StandardJavaEngine.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/StandardJavaEngine.java Sun Mar 3 10:27:29 2019 @@ -99,7 +99,7 @@ public final class StandardJavaEngine ex if (Modifier.isStatic(m.getModifiers())) { result = m.invoke(null, dctx, context); } else { - result = m.invoke(c.newInstance(), dctx, context); + result = m.invoke(c.getDeclaredConstructor().newInstance(), dctx, context); } } catch (ClassNotFoundException cnfe) { throw new GenericServiceException("Cannot find service [" + modelService.name + "] location class", cnfe); Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java Sun Mar 3 10:27:29 2019 @@ -105,7 +105,7 @@ public class RmiServiceContainer impleme if (clientProp != null && UtilValidate.isNotEmpty(clientProp.value)) { try { Class<?> c = loader.loadClass(clientProp.value); - csf = (RMIClientSocketFactory) c.newInstance(); + csf = (RMIClientSocketFactory) c.getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new ContainerException(e); } @@ -113,7 +113,7 @@ public class RmiServiceContainer impleme if (serverProp != null && UtilValidate.isNotEmpty(serverProp.value)) { try { Class<?> c = loader.loadClass(serverProp.value); - ssf = (RMIServerSocketFactory) c.newInstance(); + ssf = (RMIServerSocketFactory) c.getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new ContainerException(e); } Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavServlet.java Sun Mar 3 10:27:29 2019 @@ -67,7 +67,7 @@ public class WebDavServlet extends Gener this.dispatcher = ServiceContainer.getLocalDispatcher(dispatcherName, this.delegator); this.security = SecurityFactory.getInstance(this.delegator); String factoryClassName = context.getInitParameter("requestHandlerFactoryClass"); - this.handlerFactory = (RequestHandlerFactory) Class.forName(factoryClassName).newInstance(); + this.handlerFactory = (RequestHandlerFactory) Class.forName(factoryClassName).getDeclaredConstructor().newInstance(); } catch (Exception e) { Debug.logError(e, "Error while initializing WebDAV servlet: ", module); throw new ServletException(e); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetContentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetContentWorker.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetContentWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetContentWorker.java Sun Mar 3 10:27:29 2019 @@ -33,12 +33,9 @@ public final class WidgetContentWorker { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); // note: loadClass is necessary for these since this class doesn't know anything about them at compile time - contentWorker = (ContentWorkerInterface) loader.loadClass("org.apache.ofbiz.content.content.ContentWorker").newInstance(); - } catch (ClassNotFoundException e) { - Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); - } catch (IllegalAccessException e) { - Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); - } catch (InstantiationException e) { + Class<?> c = loader.loadClass("org.apache.ofbiz.content.content.ContentWorker"); + contentWorker = (ContentWorkerInterface) c.getDeclaredConstructor().newInstance(); + } catch (ReflectiveOperationException e) { Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); } } Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetDataResourceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetDataResourceWorker.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetDataResourceWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/content/WidgetDataResourceWorker.java Sun Mar 3 10:27:29 2019 @@ -31,12 +31,8 @@ public final class WidgetDataResourceWor try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); // note: loadClass is necessary for these since this class doesn't know anything about them at compile time - dataresourceWorker = (DataResourceWorkerInterface) loader.loadClass("org.apache.ofbiz.content.data.DataResourceWorker").newInstance(); - } catch (ClassNotFoundException e) { - Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); - } catch (IllegalAccessException e) { - Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); - } catch (InstantiationException e) { + dataresourceWorker = (DataResourceWorkerInterface) loader.loadClass("org.apache.ofbiz.content.data.DataResourceWorker").getDeclaredConstructor().newInstance(); + } catch (ReflectiveOperationException e) { Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); } } Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java?rev=1854683&r1=1854682&r2=1854683&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java Sun Mar 3 10:27:29 2019 @@ -217,11 +217,11 @@ public class HtmlMenuWrapper { if (menuWrapper == null) { try { Class<?> cls = Class.forName("org.apache.ofbiz.widget.html." + menuWrapperClassName); - menuWrapper = (HtmlMenuWrapper)cls.newInstance(); + menuWrapper = (HtmlMenuWrapper)cls.getDeclaredConstructor().newInstance(); menuWrapper.init(menuDefFile, menuName, request, response); } catch (InstantiationException | IllegalAccessException | IOException | SAXException | ParserConfigurationException e) { throw new RuntimeException(e.getMessage()); - } catch (ClassNotFoundException e) { + } catch (ReflectiveOperationException e) { throw new RuntimeException("Class not found:" + e.getMessage()); } } else { |
Free forum by Nabble | Edit this page |