Author: adrianc
Date: Thu Jan 14 18:15:08 2010
New Revision: 899339
URL:
http://svn.apache.org/viewvc?rev=899339&view=revLog:
Fixed some issues in the ArtifactPath class that Adam Heath mentioned.
Modified:
ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ArtifactPath.java
Modified: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ArtifactPath.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ArtifactPath.java?rev=899339&r1=899338&r2=899339&view=diff==============================================================================
--- ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ArtifactPath.java (original)
+++ ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ArtifactPath.java Thu Jan 14 18:15:08 2010
@@ -29,12 +29,11 @@
public static final String PATH_ROOT_NODE_NAME = "ofbiz";
public static final String PATH_ELEMENT_SEPARATOR = "/";
- public static final ArtifactPath PATH_ROOT = new ArtifactPath(PATH_ROOT_NODE_NAME);
+ public static final ArtifactPath PATH_ROOT = new PathRoot();
protected int currentIndex = 0;
protected final String[] pathElementArray;
protected FastList<Integer> stack = null;
- protected final TextBuilder stringBuilder = TextBuilder.newInstance();
public ArtifactPath(String artifactPath) {
this.pathElementArray = artifactPath.split(PATH_ELEMENT_SEPARATOR);
@@ -56,7 +55,8 @@
}
protected String getPathAsString(int index) {
- this.stringBuilder.clear();
+ TextBuilder stringBuilder = TextBuilder.newInstance();
+ stringBuilder.clear();
for (int i = index; i < this.pathElementArray.length; i++) {
if (i != index) {
stringBuilder.append(PATH_ELEMENT_SEPARATOR);
@@ -101,4 +101,36 @@
public String toString() {
return getPathAsString(0);
}
+
+ protected static class PathRoot extends ArtifactPath {
+ PathRoot() {
+ super(new String[]{PATH_ROOT_NODE_NAME});
+ }
+
+ @Override
+ public String getCurrentPath() {
+ return PATH_ROOT_NODE_NAME;
+ }
+
+ @Override
+ public String getCurrentPathElement() {
+ return PATH_ROOT_NODE_NAME;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return false;
+ }
+
+ @Override
+ public String next() {
+ throw new NoSuchElementException();
+ }
+
+ @Override
+ public void restoreState() {}
+
+ @Override
+ public void saveState() {}
+ }
}