Author: jleroux Date: Thu Aug 8 08:00:10 2013 New Revision: 1511611 URL: http://svn.apache.org/r1511611 Log: "Applied fix from trunk for revision: 1459222" ------------------------------------------------------------------------ r1459222 | mor | 2013-03-21 11:49:38 +0100 (jeu., 21 mars 2013) | 1 line
OrderItemAttributes not correctly saved while creating an order due to a typo in a variable name, reported and patch provided by Mirko as part of OFBIZ-5158. ------------------------------------------------------------------------ Modified: ofbiz/branches/release12.04/ (props changed) ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/branches/release12.04/build.xml ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java Propchange: ofbiz/branches/release12.04/ ------------------------------------------------------------------------------ Merged /ofbiz/trunk:r1459222 Modified: ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1511611&r1=1511610&r2=1511611&view=diff ============================================================================== --- ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Aug 8 08:00:10 2013 @@ -610,7 +610,7 @@ public class OrderServices { // set the order item attributes List<GenericValue> orderItemAttributes = UtilGenerics.checkList(context.get("orderItemAttributes")); if (UtilValidate.isNotEmpty(orderItemAttributes)) { - for(GenericValue oiatt : orderAttributes) { + for(GenericValue oiatt : orderItemAttributes) { oiatt.set("orderId", orderId); toBeStored.add(oiatt); } Modified: ofbiz/branches/release12.04/build.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/build.xml?rev=1511611&r1=1511610&r2=1511611&view=diff ============================================================================== --- ofbiz/branches/release12.04/build.xml (original) +++ ofbiz/branches/release12.04/build.xml Thu Aug 8 08:00:10 2013 @@ -874,6 +874,7 @@ under the License. <jvmarg value="${memory.max.param}"/> <jvmarg value="${memory.maxpermsize.param}"/> <arg value="test"/> + <arg value="-portoffset=${portoffset}"/> <env key="LC_ALL" value="C"/> </java> <mkdir dir="runtime/logs/test-results/html"/> Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java?rev=1511611&r1=1511610&r2=1511611&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java (original) +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java Thu Aug 8 08:00:10 2013 @@ -18,11 +18,11 @@ *******************************************************************************/ package org.ofbiz.base.container; +import java.net.URL; + +import org.ofbiz.base.start.Classpath; import org.ofbiz.base.util.CachedClassLoader; import org.ofbiz.base.util.Debug; -import org.ofbiz.base.start.Classpath; - -import java.net.URL; /** * ClassLoader Container; Created a CachedClassLoader for use by all following containers @@ -32,6 +32,7 @@ public class ClassLoaderContainer implem public static final String module = ClassLoaderContainer.class.getName(); protected static CachedClassLoader cl = null; + public static Integer portOffset = null; /** * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String) @@ -46,6 +47,34 @@ public class ClassLoaderContainer implem } cl = new CachedClassLoader(new URL[0], parent); + + if (args != null) { + for (String argument : args) { + // arguments can prefix w/ a '-'. Just strip them off + if (argument.startsWith("-")) { + int subIdx = 1; + if (argument.startsWith("--")) { + subIdx = 2; + } + argument = argument.substring(subIdx); + } + + // parse the arguments + if (argument.indexOf("=") != -1) { + String argumentName = argument.substring(0, argument.indexOf("=")); + String argumentVal = argument.substring(argument.indexOf("=") + 1); + + if ("portoffset".equalsIgnoreCase(argumentName)) { + try { + ClassLoaderContainer.portOffset = Integer.valueOf(argumentVal); + } catch (NumberFormatException e) { + e.printStackTrace(); + } + } + } + } + } + Thread.currentThread().setContextClassLoader(cl); Debug.logInfo("CachedClassLoader created", module); } Modified: ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java?rev=1511611&r1=1511610&r2=1511611&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java (original) +++ ofbiz/branches/release12.04/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java Thu Aug 8 08:00:10 2013 @@ -54,6 +54,9 @@ public class NamingServiceContainer impl if (port.value != null) { try { this.namingPort = Integer.parseInt(port.value); + if (ClassLoaderContainer.portOffset != null) { + this.namingPort += ClassLoaderContainer.portOffset; + } } catch (Exception e) { throw new ContainerException("Invalid port defined in container [naming-container] configuration; not a valid int"); } Modified: ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1511611&r1=1511610&r2=1511611&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original) +++ ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Thu Aug 8 08:00:10 2013 @@ -235,6 +235,13 @@ public class CatalinaContainer implement public boolean start() throws ContainerException { // Start the Tomcat server try { + if (ClassLoaderContainer.portOffset != null) { + for (Connector con: tomcat.getService().findConnectors()) { + int port = con.getPort(); + port += ClassLoaderContainer.portOffset; + con.setPort(port); + } + } tomcat.getServer().start(); } catch (LifecycleException e) { throw new ContainerException(e); @@ -244,6 +251,9 @@ public class CatalinaContainer implement loadComponents(); for (Connector con: tomcat.getService().findConnectors()) { + int port = con.getPort(); + port += ClassLoaderContainer.portOffset; + con.setPort(port); ProtocolHandler ph = con.getProtocolHandler(); if (ph instanceof Http11Protocol) { Http11Protocol hph = (Http11Protocol) ph; @@ -483,6 +493,10 @@ public class CatalinaContainer implement String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1"); String address = ContainerConfig.getPropertyValue(connectorProp, "address", "0.0.0.0"); int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0); + if (ClassLoaderContainer.portOffset != null) { + port += ClassLoaderContainer.portOffset; + } + boolean secure = ContainerConfig.getPropertyValue(connectorProp, "secure", false); if (protocol.toLowerCase().startsWith("ajp")) { protocol = "ajp"; Modified: ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml?rev=1511611&r1=1511610&r2=1511611&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml (original) +++ ofbiz/branches/release12.04/framework/common/servicedef/services_test.xml Thu Aug 8 08:00:10 2013 @@ -82,28 +82,23 @@ under the License. <service name="groupTest" engine="group" location="testGroup" invoke=""/> - <service name="testHttp" engine="http" - location="http://localhost:8080/webtools/control/httpService" invoke="testScv"> + <service name="testHttp" engine="http" location="main-http" invoke="testScv"> <description>HTTP service wrapper around the test service</description> <attribute name="message" type="String" mode="IN" optional="true"/> <attribute name="resp" type="String" mode="OUT"/> </service> - <service name="testSoap" engine="soap" export="true" - location="http://localhost:8080/webtools/control/SOAPService" invoke="testSOAPScv"> + <service name="testSoap" engine="soap" export="true" location="main-local-soap" invoke="testSOAPScv"> <description>SOAP service; calls the OFBiz test SOAP service</description> <implements service="testSOAPScv"/> </service> - <service name="testSoapSimple" engine="soap" export="true" - location="http://localhost:8080/webtools/control/SOAPService" invoke="testScv"> + <service name="testSoapSimple" engine="soap" export="true" location="main-local-soap" invoke="testScv"> <description>simple SOAP service; calls the OFBiz test service</description> <implements service="testScv"/> </service> - <service name="testRemoteSoap" engine="soap" export="true" - location="http://demo-trunk.ofbiz.apache.org:8080/webtools/control/SOAPService" - invoke="testSoapSimple"> + <service name="testRemoteSoap" engine="soap" export="true" location="main-remote-soap" invoke="testSoapSimple"> <attribute name="defaultValue" type="Double" mode="IN" default-value="999.9999"/> <attribute name="message" type="String" mode="IN" optional="true"/> <attribute name="resp" type="String" mode="OUT"/> Modified: ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java?rev=1511611&r1=1511610&r2=1511611&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java (original) +++ ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/engine/AbstractEngine.java Thu Aug 8 08:00:10 2013 @@ -18,21 +18,21 @@ *******************************************************************************/ package org.ofbiz.service.engine; -import java.util.Map; -import java.util.List; import java.util.Iterator; +import java.util.List; +import java.util.Map; import javolution.util.FastMap; -import org.ofbiz.service.ServiceDispatcher; -import org.ofbiz.service.ModelService; -import org.ofbiz.service.GenericServiceException; -import org.ofbiz.service.GenericServiceCallback; -import org.ofbiz.service.config.ServiceConfigUtil; import org.ofbiz.base.config.GenericConfigException; +import org.ofbiz.base.container.ClassLoaderContainer; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilXml; - +import org.ofbiz.service.GenericServiceCallback; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.ModelService; +import org.ofbiz.service.ServiceDispatcher; +import org.ofbiz.service.config.ServiceConfigUtil; import org.w3c.dom.Element; /** @@ -66,7 +66,12 @@ public abstract class AbstractEngine imp List<? extends Element> locationElements = UtilXml.childElementList(root, "service-location"); if (locationElements != null) { for (Element e: locationElements) { - locationMap.put(e.getAttribute("name"), e.getAttribute("location")); + String location = e.getAttribute("location"); + if (location.contains("localhost") && ClassLoaderContainer.portOffset != null) { + Integer port = 8080 + ClassLoaderContainer.portOffset; + location.replace("8080", port.toString()); + } + locationMap.put(e.getAttribute("name"), location); } } } Modified: ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java?rev=1511611&r1=1511610&r2=1511611&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java (original) +++ ofbiz/branches/release12.04/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java Thu Aug 8 08:00:10 2013 @@ -26,6 +26,7 @@ import java.rmi.server.RMIServerSocketFa import javax.naming.InitialContext; import javax.naming.NamingException; +import org.ofbiz.base.container.ClassLoaderContainer; import org.ofbiz.base.container.Container; import org.ofbiz.base.container.ContainerConfig; import org.ofbiz.base.container.ContainerException; @@ -81,6 +82,11 @@ public class RmiServiceContainer impleme String useCtx = initialCtxProp == null || initialCtxProp.value == null ? "false" : initialCtxProp.value; String host = lookupHostProp == null || lookupHostProp.value == null ? "localhost" : lookupHostProp.value; String port = lookupPortProp == null || lookupPortProp.value == null ? "1099" : lookupPortProp.value; + if (ClassLoaderContainer.portOffset != null) { + Integer portValue = Integer.valueOf(port); + portValue += ClassLoaderContainer.portOffset; + port = portValue.toString(); + } String keystore = ContainerConfig.getPropertyValue(cfg, "ssl-keystore", null); String ksType = ContainerConfig.getPropertyValue(cfg, "ssl-keystore-type", "JKS"); String ksPass = ContainerConfig.getPropertyValue(cfg, "ssl-keystore-pass", null);