Author: jleroux
Date: Sun Sep 14 08:42:56 2014
New Revision: 1624812
URL: http://svn.apache.org/r1624812
Log:
"Applied fix from trunk for revision: 1624767" (conflicts handled by hand)
------------------------------------------------------------------------
r1624767 | jacopoc | 2014-09-13 19:05:03 +0200 (sam. 13 sept. 2014) | 4 lignes
Fixed the regression that Jacques introduced with the work on portOffset when
the immutability of ServiceLocation was broken; now the class is thread-safe
again.
However the portOffset code, before and after my fix, is really ugly and should
be reverted completely: the "8080" and "1099" ports, that are configurable in
OFBiz, are hardcoded in the portOffset code and so this code can only work when
OFBiz is executed with the default ports.
------------------------------------------------------------------------
Modified:
ofbiz/branches/release13.07/ (props changed)
ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java
ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceLocation.java
Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1624767
Modified:
ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java?rev=1624812&r1=1624811&r2=1624812&view=diff
==============================================================================
---
ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java
(original)
+++
ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java
Sun Sep 14 08:42:56 2014
@@ -24,8 +24,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.ofbiz.base.container.ClassLoaderContainer;
import org.ofbiz.base.lang.ThreadSafe;
+import org.ofbiz.base.start.Start;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.service.config.ServiceConfigException;
import org.w3c.dom.Element;
@@ -87,17 +87,14 @@ public final class ServiceEngine {
} else {
List<ServiceLocation> serviceLocations = new
ArrayList<ServiceLocation>(serviceLocationElementList.size());
for (Element serviceLocationElement : serviceLocationElementList) {
- serviceLocations.add(new
ServiceLocation(serviceLocationElement));
- }
- for (ServiceLocation serviceLocation : serviceLocations) {
- String location = serviceLocation.getLocation();
- if (location.contains("localhost") &&
ClassLoaderContainer.portOffset != 0) {
- Integer port = 1099 + ClassLoaderContainer.portOffset;
+ String location =
serviceLocationElement.getAttribute("location").intern();
+ if (location.contains("localhost") &&
Start.getInstance().getConfig().portOffset != 0) {
+ Integer port = 1099 +
Start.getInstance().getConfig().portOffset;
location = location.replace("1099", port.toString());
port = 8080 + ClassLoaderContainer.portOffset;
location = location.replace("8080", port.toString());
- serviceLocation.setLocation(location);
- }
+ }
+ serviceLocations.add(new
ServiceLocation(serviceLocationElement, location));
}
this.serviceLocations =
Collections.unmodifiableList(serviceLocations);
}
Modified:
ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceLocation.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceLocation.java?rev=1624812&r1=1624811&r2=1624812&view=diff
==============================================================================
---
ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceLocation.java
(original)
+++
ofbiz/branches/release13.07/framework/service/src/org/ofbiz/service/config/model/ServiceLocation.java
Sun Sep 14 08:42:56 2014
@@ -28,16 +28,15 @@ import org.w3c.dom.Element;
@ThreadSafe
public final class ServiceLocation {
- private String location;
+ private final String location;
private final String name;
- ServiceLocation(Element serviceLocationElement) throws
ServiceConfigException {
+ ServiceLocation(Element serviceLocationElement, String location) throws
ServiceConfigException {
String name = serviceLocationElement.getAttribute("name").intern();
if (name.isEmpty()) {
throw new ServiceConfigException("<service-location> element name
attribute is empty");
}
this.name = name;
- String location =
serviceLocationElement.getAttribute("location").intern();
if (location.isEmpty()) {
throw new ServiceConfigException("<service-location> element
location attribute is empty");
}
@@ -48,10 +47,6 @@ public final class ServiceLocation {
return location;
}
- public void setLocation(String location) {
- this.location = location;
- }
-
public String getName() {
return name;
}