svn commit: r1817882 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component: ComponentConfig.java ComponentLoaderConfig.java ComponentResourceHandler.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1817882 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component: ComponentConfig.java ComponentLoaderConfig.java ComponentResourceHandler.java

mbrohl
Author: mbrohl
Date: Tue Dec 12 06:24:37 2017
New Revision: 1817882

URL: http://svn.apache.org/viewvc?rev=1817882&view=rev
Log:
Reverted: General refactoring and code improvements, package
org.apache.ofbiz.base.component.
(OFBIZ-9872)

The patches were modified to remove Debug.is[Loglevel]On()
conditions. It is better to keep them for better runtime performance.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java?rev=1817882&r1=1817881&r2=1817882&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java Tue Dec 12 06:24:37 2017
@@ -47,7 +47,7 @@ import org.w3c.dom.Element;
 
 /**
  * An object that models the <code>&lt;ofbiz-component&gt;</code> element.
- *
+ *
  * @see <code>ofbiz-component.xsd</code>
  *
  */
@@ -458,7 +458,8 @@ public final class ComponentConfig {
         } catch (ContainerException ce) {
             throw new ComponentException("Error reading container configurations for component: " + this.globalName, ce);
         }
-        Debug.logVerbose("Read component config : [" + rootLocation + "]", module);
+        if (Debug.verboseOn())
+            Debug.logVerbose("Read component config : [" + rootLocation + "]", module);
     }
 
     public boolean enabled() {
@@ -595,7 +596,7 @@ public final class ComponentConfig {
 
     /**
      * An object that models the <code>&lt;classpath&gt;</code> element.
-     *
+     *
      * @see <code>ofbiz-component.xsd</code>
      *
      */
@@ -618,7 +619,7 @@ public final class ComponentConfig {
         private final Map<String, ComponentConfig> componentConfigs = new LinkedHashMap<>();
         // Root location mapped to global name.
         private final Map<String, String> componentLocations = new HashMap<>();
-
+        
         private synchronized ComponentConfig fromGlobalName(String globalName) {
             return componentConfigs.get(globalName);
         }
@@ -645,7 +646,7 @@ public final class ComponentConfig {
 
     /**
      * An object that models the <code>&lt;entity-resource&gt;</code> element.
-     *
+     *
      * @see <code>ofbiz-component.xsd</code>
      *
      */
@@ -662,7 +663,7 @@ public final class ComponentConfig {
 
     /**
      * An object that models the <code>&lt;keystore&gt;</code> element.
-     *
+     *
      * @see <code>ofbiz-component.xsd</code>
      *
      */
@@ -739,7 +740,7 @@ public final class ComponentConfig {
 
     /**
      * An object that models the <code>&lt;resource-loader&gt;</code> element.
-     *
+     *
      * @see <code>ofbiz-component.xsd</code>
      *
      */
@@ -759,7 +760,7 @@ public final class ComponentConfig {
 
     /**
      * An object that models the <code>&lt;service-resource&gt;</code> element.
-     *
+     *
      * @see <code>ofbiz-component.xsd</code>
      *
      */
@@ -774,7 +775,7 @@ public final class ComponentConfig {
 
     /**
      * An object that models the <code>&lt;test-suite&gt;</code> element.
-     *
+     *
      * @see <code>ofbiz-component.xsd</code>
      *
      */
@@ -786,7 +787,7 @@ public final class ComponentConfig {
 
     /**
      * An object that models the <code>&lt;webapp&gt;</code> element.
-     *
+     *
      * @see <code>ofbiz-component.xsd</code>
      *
      */

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java?rev=1817882&r1=1817881&r2=1817882&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java Tue Dec 12 06:24:37 2017
@@ -55,7 +55,7 @@ public final class ComponentLoaderConfig
     public static List<ComponentDef> getComponentsFromConfig(URL configUrl) throws ComponentException {
         Document document = parseDocumentFromUrl(configUrl);
         List<? extends Element> toLoad = UtilXml.childElementList(document.getDocumentElement());
-        List<ComponentDef> componentsFromConfig = new ArrayList<>();
+        List<ComponentDef> componentsFromConfig = new ArrayList<ComponentDef>();
 
         for (Element element : toLoad) {
             componentsFromConfig.add(retrieveComponentDefFromElement(element, configUrl));

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java?rev=1817882&r1=1817881&r2=1817882&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java Tue Dec 12 06:24:37 2017
@@ -18,19 +18,15 @@
  *******************************************************************************/
 package org.apache.ofbiz.base.component;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 
-import javax.xml.parsers.ParserConfigurationException;
-
 import org.apache.ofbiz.base.config.GenericConfigException;
 import org.apache.ofbiz.base.config.ResourceHandler;
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilXml;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
 
 /**
  * Contains resource information and provides for loading data
@@ -54,7 +50,7 @@ public class ComponentResourceHandler im
         this.componentName = componentName;
         this.loaderName = loaderName;
         this.location = location;
-        Debug.logVerbose("Created " + this.toString(), module);
+        if (Debug.verboseOn()) Debug.logVerbose("Created " + this.toString(), module);
     }
 
     public String getLoaderName() {
@@ -68,7 +64,11 @@ public class ComponentResourceHandler im
     public Document getDocument() throws GenericConfigException {
         try {
             return UtilXml.readXmlDocument(this.getStream(), this.getFullLocation(), true);
-        } catch (SAXException | ParserConfigurationException | IOException  e) {
+        } catch (org.xml.sax.SAXException e) {
+            throw new GenericConfigException("Error reading " + this.toString(), e);
+        } catch (javax.xml.parsers.ParserConfigurationException e) {
+            throw new GenericConfigException("Error reading " + this.toString(), e);
+        } catch (java.io.IOException e) {
             throw new GenericConfigException("Error reading " + this.toString(), e);
         }
     }