Author: mbrohl
Date: Tue Dec 12 06:26:29 2017 New Revision: 1817883 URL: http://svn.apache.org/viewvc?rev=1817883&view=rev Log: Improved: General refactoring and code improvements, package org.apache.ofbiz.base.component. (OFBIZ-9872) Thanks Dennis Balkir for reporting and providing the patches. 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=1817883&r1=1817882&r2=1817883&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:26:29 2017 @@ -47,7 +47,7 @@ import org.w3c.dom.Element; /** * An object that models the <code><ofbiz-component></code> element. - * + * * @see <code>ofbiz-component.xsd</code> * */ @@ -458,8 +458,9 @@ public final class ComponentConfig { } catch (ContainerException ce) { throw new ComponentException("Error reading container configurations for component: " + this.globalName, ce); } - if (Debug.verboseOn()) + if (Debug.verboseOn()) { Debug.logVerbose("Read component config : [" + rootLocation + "]", module); + } } public boolean enabled() { @@ -596,7 +597,7 @@ public final class ComponentConfig { /** * An object that models the <code><classpath></code> element. - * + * * @see <code>ofbiz-component.xsd</code> * */ @@ -619,7 +620,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); } @@ -646,7 +647,7 @@ public final class ComponentConfig { /** * An object that models the <code><entity-resource></code> element. - * + * * @see <code>ofbiz-component.xsd</code> * */ @@ -663,7 +664,7 @@ public final class ComponentConfig { /** * An object that models the <code><keystore></code> element. - * + * * @see <code>ofbiz-component.xsd</code> * */ @@ -740,7 +741,7 @@ public final class ComponentConfig { /** * An object that models the <code><resource-loader></code> element. - * + * * @see <code>ofbiz-component.xsd</code> * */ @@ -760,7 +761,7 @@ public final class ComponentConfig { /** * An object that models the <code><service-resource></code> element. - * + * * @see <code>ofbiz-component.xsd</code> * */ @@ -775,7 +776,7 @@ public final class ComponentConfig { /** * An object that models the <code><test-suite></code> element. - * + * * @see <code>ofbiz-component.xsd</code> * */ @@ -787,7 +788,7 @@ public final class ComponentConfig { /** * An object that models the <code><webapp></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=1817883&r1=1817882&r2=1817883&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:26:29 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<ComponentDef>(); + List<ComponentDef> componentsFromConfig = new ArrayList<>(); 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=1817883&r1=1817882&r2=1817883&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:26:29 2017 @@ -18,15 +18,19 @@ *******************************************************************************/ 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 @@ -50,7 +54,9 @@ public class ComponentResourceHandler im this.componentName = componentName; this.loaderName = loaderName; this.location = location; - if (Debug.verboseOn()) Debug.logVerbose("Created " + this.toString(), module); + if (Debug.verboseOn()) { + Debug.logVerbose("Created " + this.toString(), module); + } } public String getLoaderName() { @@ -64,11 +70,7 @@ public class ComponentResourceHandler im public Document getDocument() throws GenericConfigException { try { return UtilXml.readXmlDocument(this.getStream(), this.getFullLocation(), true); - } 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) { + } catch (SAXException | ParserConfigurationException | IOException e) { throw new GenericConfigException("Error reading " + this.toString(), e); } } |
Free forum by Nabble | Edit this page |