Author: adrianc
Date: Fri Oct 31 19:29:46 2014
New Revision: 1635846
URL: http://svn.apache.org/r1635846
Log:
Remove Javolution from most of the base component. I didn't do the converters
to avoid merge conflicts with the JSON branch.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/BshUtil.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilGenerics.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapContext.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java
Fri Oct 31 19:29:46 2014
@@ -19,14 +19,15 @@
package org.ofbiz.base.concurrent;
import java.util.Collection;
+import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Delayed;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.SynchronousQueue;
@@ -34,8 +35,6 @@ import java.util.concurrent.ThreadFactor
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import javolution.util.FastList;
-
import org.ofbiz.base.lang.SourceMonitored;
import org.ofbiz.base.util.Debug;
@@ -78,7 +77,7 @@ public final class ExecutionPool {
}
public static <F> List<F> getAllFutures(Collection<Future<F>> futureList) {
- List<F> result = FastList.newInstance();
+ List<F> result = new LinkedList<F>();
for (Future<F> future: futureList) {
try {
result.add(future.get());
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java
Fri Oct 31 19:29:46 2014
@@ -18,7 +18,7 @@
*******************************************************************************/
package org.ofbiz.base.config;
-import javolution.util.FastMap;
+import java.util.concurrent.ConcurrentHashMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilXml;
@@ -32,7 +32,7 @@ public class JNDIConfigUtil {
public static final String module = JNDIConfigUtil.class.getName();
public static final String JNDI_CONFIG_XML_FILENAME = "jndiservers.xml";
- private static final FastMap<String, JndiServerInfo> jndiServerInfos =
FastMap.newInstance();
+ private static final ConcurrentHashMap<String, JndiServerInfo>
jndiServerInfos = new ConcurrentHashMap<String, JndiServerInfo>();
private static Element getXmlRootElement() throws GenericConfigException {
try {
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/BshUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/BshUtil.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/BshUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/BshUtil.java Fri Oct 31
19:29:46 2014
@@ -25,8 +25,7 @@ import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
-
-import javolution.util.FastMap;
+import java.util.concurrent.ConcurrentHashMap;
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.cache.UtilCache;
@@ -45,7 +44,7 @@ public final class BshUtil {
public static final String module = BshUtil.class.getName();
- protected static FastMap<ClassLoader, BshClassManager> masterClassManagers
= FastMap.newInstance();
+ protected static ConcurrentHashMap<ClassLoader, BshClassManager>
masterClassManagers = new ConcurrentHashMap<ClassLoader, BshClassManager>();
private static final UtilCache<String, Interpreter.ParsedScript>
parsedScripts = UtilCache.createUtilCache("script.BshLocationParsedCache", 0,
0, false);
/**
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java Fri Oct 31
19:29:46 2014
@@ -32,12 +32,11 @@ import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.net.MalformedURLException;
+import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Set;
-import javolution.util.FastList;
-import javolution.util.FastSet;
-
import org.apache.commons.io.FileUtils;
import org.ofbiz.base.location.ComponentLocationResolver;
@@ -245,8 +244,8 @@ public class FileUtil {
basePath = System.getProperty("ofbiz.home");
}
- Set<String> stringsToFindInPath = FastSet.newInstance();
- Set<String> stringsToFindInFile = FastSet.newInstance();
+ Set<String> stringsToFindInPath = new HashSet<String>();
+ Set<String> stringsToFindInFile = new HashSet<String>();
if (partialPath != null) {
stringsToFindInPath.add(partialPath);
@@ -255,7 +254,7 @@ public class FileUtil {
stringsToFindInFile.add(stringToFind);
}
- List<File> fileList = FastList.newInstance();
+ List<File> fileList = new LinkedList<File>();
FileUtil.searchFiles(fileList, new File(basePath), new
SearchTextFilesFilter(fileExt, stringsToFindInPath, stringsToFindInFile), true);
return fileList;
@@ -266,22 +265,22 @@ public class FileUtil {
basePath = System.getProperty("ofbiz.home");
}
- Set<String> stringsToFindInPath = FastSet.newInstance();
- Set<String> stringsToFindInFile = FastSet.newInstance();
+ Set<String> stringsToFindInPath = new HashSet<String>();
+ Set<String> stringsToFindInFile = new HashSet<String>();
if (partialPath != null) stringsToFindInPath.add(partialPath);
if (rootElementName != null) stringsToFindInFile.add("<" +
rootElementName + " ");
if (xsdOrDtdName != null) stringsToFindInFile.add(xsdOrDtdName);
- List<File> fileList = FastList.newInstance();
+ List<File> fileList = new LinkedList<File>();
FileUtil.searchFiles(fileList, new File(basePath), new
SearchTextFilesFilter("xml", stringsToFindInPath, stringsToFindInFile), true);
return fileList;
}
public static class SearchTextFilesFilter implements FilenameFilter {
String fileExtension;
- Set<String> stringsToFindInFile = FastSet.newInstance();
- Set<String> stringsToFindInPath = FastSet.newInstance();
+ Set<String> stringsToFindInFile = new HashSet<String>();
+ Set<String> stringsToFindInPath = new HashSet<String>();
public SearchTextFilesFilter(String fileExtension, Set<String>
stringsToFindInPath, Set<String> stringsToFindInFile) {
this.fileExtension = fileExtension;
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java Fri Oct
31 19:29:46 2014
@@ -26,12 +26,11 @@ import groovy.lang.Script;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.HashMap;
import java.util.Map;
import javax.script.ScriptContext;
-import javolution.util.FastMap;
-
import org.codehaus.groovy.control.CompilationFailedException;
import org.codehaus.groovy.runtime.InvokerHelper;
import org.ofbiz.base.location.FlexibleLocation;
@@ -95,7 +94,7 @@ public class GroovyUtil {
* @return A <code>Binding</code> instance
*/
public static Binding getBinding(Map<String, Object> context) {
- Map<String, Object> vars = FastMap.newInstance();
+ Map<String, Object> vars = new HashMap<String, Object>();
if (context != null) {
vars.putAll(context);
vars.put("context", context);
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java
Fri Oct 31 19:29:46 2014
@@ -24,13 +24,12 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
+import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
-import javolution.util.FastMap;
-
/**
* HttpRequestFileUpload - Receive a file upload through an HttpServletRequest
*
@@ -140,7 +139,7 @@ public class HttpRequestFileUpload {
String boundary = new String(line, 0, boundaryLength); // -2 discards
the newline character
System.out.println("boundary=[" + boundary + "] length is " +
boundaryLength);
- fields = FastMap.newInstance();
+ fields = new HashMap<String, String>();
while (requestLength > 0/* i != -1*/) {
String newLine = "";
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java Fri
Oct 31 19:29:46 2014
@@ -46,10 +46,9 @@ import java.security.cert.X509Certificat
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Map;
-import javolution.util.FastMap;
-
import org.apache.commons.codec.binary.Base64;
import org.ofbiz.base.component.ComponentConfig;
import org.ofbiz.base.config.GenericConfigException;
@@ -143,7 +142,7 @@ public class KeyStoreUtil {
}
public static Map<String, String> getX500Map(Principal x500) {
- Map<String, String> x500Map = FastMap.newInstance();
+ Map<String, String> x500Map = new HashMap<String, String>();
String name = x500.getName().replaceAll("\\\\,", "&com;");
String[] x500Opts = name.split("\\,");
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java
Fri Oct 31 19:29:46 2014
@@ -25,12 +25,11 @@ import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Enumeration;
+import java.util.LinkedList;
import java.util.List;
import javax.net.ssl.X509TrustManager;
-import javolution.util.FastList;
-
/**
* MultiTrustManager
*/
@@ -46,7 +45,7 @@ public class MultiTrustManager implement
}
public MultiTrustManager() {
- keystores = FastList.newInstance();
+ keystores = new LinkedList<KeyStore>();
}
public void add(KeyStore ks) {
@@ -78,7 +77,7 @@ public class MultiTrustManager implement
}
public X509Certificate[] getAcceptedIssuers() {
- List<X509Certificate> issuers = FastList.newInstance();
+ List<X509Certificate> issuers = new LinkedList<X509Certificate>();
for (KeyStore store: keystores) {
try {
Enumeration<String> e = store.aliases();
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java Fri Oct 31
19:29:46 2014
@@ -18,23 +18,21 @@
*******************************************************************************/
package org.ofbiz.base.util;
-import org.ofbiz.base.config.GenericConfigException;
-import org.ofbiz.base.component.ComponentConfig;
-
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
-import java.security.SecureRandom;
import java.security.Principal;
-import java.security.cert.X509Certificate;
+import java.security.SecureRandom;
import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
import java.util.Arrays;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLServerSocketFactory;
@@ -44,7 +42,8 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.X509KeyManager;
import javax.net.ssl.X509TrustManager;
-import javolution.util.FastList;
+import org.ofbiz.base.component.ComponentConfig;
+import org.ofbiz.base.config.GenericConfigException;
/**
* KeyStoreUtil - Utilities for setting up SSL connections with specific
client certificates
@@ -92,7 +91,7 @@ public class SSLUtil {
}
public static KeyManager[] getKeyManagers(String alias) throws
IOException, GeneralSecurityException, GenericConfigException {
- List<KeyManager> keyMgrs = FastList.newInstance();
+ List<KeyManager> keyMgrs = new LinkedList<KeyManager>();
for (ComponentConfig.KeystoreInfo ksi:
ComponentConfig.getAllKeystoreInfos()) {
if (ksi.isCertStore()) {
KeyStore ks = ksi.getKeyStore();
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Fri Oct
31 19:29:46 2014
@@ -23,19 +23,16 @@ import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
-import javolution.context.ObjectFactory;
-import javolution.lang.Reusable;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-import javolution.util.FastSet;
-
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.ofbiz.base.lang.Appender;
@@ -56,6 +53,7 @@ public class StringUtil {
public static final StringUtil INSTANCE = new StringUtil();
public static final String module = StringUtil.class.getName();
+ // FIXME: Not thread safe
protected static final Map<String, Pattern> substitutionPatternMap;
/** OWASP ESAPI canonicalize strict flag; setting false so we only get
warnings about double encoding, etc; can be set to true for exceptions and more
security */
@@ -67,7 +65,7 @@ public class StringUtil {
List<Codec> codecList = Arrays.asList(new HTMLEntityCodec(), new
PercentCodec());
defaultWebEncoder = new DefaultEncoder(codecList);
defaultWebValidator = new DefaultValidator();
- substitutionPatternMap = FastMap.newInstance();
+ substitutionPatternMap = new HashMap<String, Pattern>();
substitutionPatternMap.put("&&", Pattern.compile("@and",
Pattern.LITERAL));
substitutionPatternMap.put("||", Pattern.compile("@or",
Pattern.LITERAL));
substitutionPatternMap.put("<=", Pattern.compile("@lteq",
Pattern.LITERAL));
@@ -203,7 +201,7 @@ public class StringUtil {
else st = new StringTokenizer(str);
if (st != null && st.hasMoreTokens()) {
- splitList = FastList.newInstance();
+ splitList = new LinkedList<String>();
while (st.hasMoreTokens())
splitList.add(st.nextToken());
@@ -229,7 +227,7 @@ public class StringUtil {
if (st != null && st.length > 0) {
- splitList = FastList.newInstance();
+ splitList = new LinkedList<String>();
for (int i=0; i < st.length; i++) splitList.add(st[i]);
}
@@ -241,9 +239,7 @@ public class StringUtil {
* @param list List of String(s) to quote.
*/
public static List<String> quoteStrList(List<String> list) {
- List<String> tmpList = list;
-
- list = FastList.newInstance();
+ List<String> tmpList = new LinkedList<String>();
for (String str: tmpList) {
str = "'" + str + "'";
list.add(str);
@@ -274,7 +270,7 @@ public class StringUtil {
*/
public static Map<String, String> strToMap(String str, String delim,
boolean trim, String pairsSeparator) {
if (str == null) return null;
- Map<String, String> decodedMap = FastMap.newInstance();
+ Map<String, String> decodedMap = new HashMap<String, String>();
List<String> elements = split(str, delim);
pairsSeparator = pairsSeparator == null ? "=" : pairsSeparator;
@@ -384,7 +380,7 @@ public class StringUtil {
* @return new Map
*/
public static Map<String, String> toMap(String s) {
- Map<String, String> newMap = FastMap.newInstance();
+ Map<String, String> newMap = new HashMap<String, String>();
if (s.startsWith("{") && s.endsWith("}")) {
s = s.substring(1, s.length() - 1);
String[] entries = s.split("\\,\\s");
@@ -408,7 +404,7 @@ public class StringUtil {
* @return new List
*/
public static List<String> toList(String s) {
- List<String> newList = FastList.newInstance();
+ List<String> newList = new LinkedList<String>();
if (s.startsWith("[") && s.endsWith("]")) {
s = s.substring(1, s.length() - 1);
String[] entries = s.split("\\,\\s");
@@ -429,7 +425,7 @@ public class StringUtil {
* @return new List
*/
public static Set<String> toSet(String s) {
- Set<String> newSet = FastSet.newInstance();
+ Set<String> newSet = new HashSet<String>();
if (s.startsWith("[") && s.endsWith("]")) {
s = s.substring(1, s.length() - 1);
String[] entries = s.split("\\,\\s");
@@ -454,7 +450,7 @@ public class StringUtil {
if (keys == null || values == null || keys.size() != values.size()) {
throw new IllegalArgumentException("Keys and Values cannot be null
and must be the same size");
}
- Map<K, V> newMap = FastMap.newInstance();
+ Map<K, V> newMap = new HashMap<K, V>();
for (int i = 0; i < keys.size(); i++) {
newMap.put(keys.get(i), values.get(i));
}
@@ -791,19 +787,12 @@ public class StringUtil {
/**
* A simple Map wrapper class that will do HTML encoding. To be used for
passing a Map to something that will expand Strings with it as a context, etc.
- * To reduce memory allocation impact this object is recyclable and
minimal in that it only keeps a reference to the original Map.
*/
- public static class HtmlEncodingMapWrapper<K> implements Map<K, Object>,
Reusable {
- protected static final ObjectFactory<HtmlEncodingMapWrapper<?>>
mapStackFactory = new ObjectFactory<HtmlEncodingMapWrapper<?>>() {
- @Override
- protected HtmlEncodingMapWrapper<?> create() {
- return new HtmlEncodingMapWrapper<Object>();
- }
- };
+ public static class HtmlEncodingMapWrapper<K> implements Map<K, Object> {
public static <K> HtmlEncodingMapWrapper<K>
getHtmlEncodingMapWrapper(Map<K, Object> mapToWrap, SimpleEncoder encoder) {
if (mapToWrap == null) return null;
- HtmlEncodingMapWrapper<K> mapWrapper = (HtmlEncodingMapWrapper<K>)
UtilGenerics.<K, Object>checkMap(mapStackFactory.object());
+ HtmlEncodingMapWrapper<K> mapWrapper = new
HtmlEncodingMapWrapper<K>();
mapWrapper.setup(mapToWrap, encoder);
return mapWrapper;
}
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilGenerics.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilGenerics.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilGenerics.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilGenerics.java Fri
Oct 31 19:29:46 2014
@@ -19,13 +19,12 @@
package org.ofbiz.base.util;
import java.util.Collection;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
-import javolution.util.FastMap;
-
public class UtilGenerics {
public static final String module = UtilMisc.class.getName();
@@ -141,7 +140,7 @@ public class UtilGenerics {
if (data.length % 2 == 1) {
throw new IllegalArgumentException("You must pass an even sized
array to the toMap method");
}
- Map<K, V> map = FastMap.newInstance();
+ Map<K, V> map = new LinkedHashMap<K, V>();
for (int i = 0; i < data.length;) {
Object key = data[i];
if (key != null && !(keyType.isInstance(key))) throw new
IllegalArgumentException("Key(" + i + ") is not a " + keyType.getName() + ",
was(" + key.getClass().getName() + ")");
@@ -162,7 +161,7 @@ public class UtilGenerics {
if (data.length % 2 == 1) {
throw new IllegalArgumentException("You must pass an even sized
array to the toMap method");
}
- Map<K, Object> map = FastMap.newInstance();
+ Map<K, Object> map = new LinkedHashMap<K, Object>();
for (int i = 0; i < data.length;) {
Object key = data[i];
if (key != null && !(keyType.isInstance(key))) throw new
IllegalArgumentException("Key(" + i + ") is not a " + keyType.getName() + ",
was(" + key.getClass().getName() + ")");
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java Fri Oct 31
19:29:46 2014
@@ -35,6 +35,7 @@ import java.util.Currency;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -47,9 +48,6 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
import org.apache.commons.lang.RandomStringUtils;
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.Pattern;
@@ -88,7 +86,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getCombinedMap(HttpServletRequest
request, Set<? extends String> namesToSkip) {
- FastMap<String, Object> combinedMap = FastMap.newInstance();
+ Map<String, Object> combinedMap = new HashMap<String, Object>();
combinedMap.putAll(getParameterMap(request)); //
parameters override nothing
combinedMap.putAll(getServletContextMap(request, namesToSkip)); //
bottom level application attributes
combinedMap.putAll(getSessionMap(request, namesToSkip)); //
session overrides application
@@ -162,7 +160,7 @@ public class UtilHttp {
}
public static Map<String, Object> getQueryStringOnlyParameterMap(String
queryString) {
- Map<String, Object> paramMap = FastMap.newInstance();
+ Map<String, Object> paramMap = new HashMap<String, Object>();
if (UtilValidate.isNotEmpty(queryString)) {
StringTokenizer queryTokens = new StringTokenizer(queryString,
"&");
while (queryTokens.hasMoreTokens()) {
@@ -189,7 +187,7 @@ public class UtilHttp {
public static Map<String, Object> getPathInfoOnlyParameterMap(String
pathInfoStr, Set<? extends String> nameSet, Boolean onlyIncludeOrSkip) {
boolean onlyIncludeOrSkipPrim = onlyIncludeOrSkip == null ? true :
onlyIncludeOrSkip.booleanValue();
- Map<String, Object> paramMap = FastMap.newInstance();
+ Map<String, Object> paramMap = new HashMap<String, Object>();
// now add in all path info parameters /~name1=value1/~name2=value2/
// note that if a parameter with a given name already exists it will
be put into a list with all values
@@ -218,7 +216,7 @@ public class UtilHttp {
paramList.add(value);
} else {
String paramString = (String) curValue;
- paramList = FastList.newInstance();
+ paramList = new LinkedList<String>();
paramList.add(paramString);
paramList.add(value);
}
@@ -249,7 +247,7 @@ public class UtilHttp {
if (paramEntry.getValue() instanceof String) {
paramEntry.setValue(canonicalizeParameter((String)
paramEntry.getValue()));
} else if (paramEntry.getValue() instanceof Collection<?>) {
- List<String> newList = FastList.newInstance();
+ List<String> newList = new LinkedList<String>();
for (String listEntry:
UtilGenerics.<String>checkCollection(paramEntry.getValue())) {
newList.add(canonicalizeParameter(listEntry));
}
@@ -275,7 +273,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getJSONAttributeMap(HttpServletRequest
request) {
- Map<String, Object> returnMap = FastMap.newInstance();
+ Map<String, Object> returnMap = new HashMap<String, Object>();
Map<String, Object> attrMap = getAttributeMap(request);
for (Map.Entry<String, Object> entry : attrMap.entrySet()) {
String key = entry.getKey();
@@ -305,7 +303,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getAttributeMap(HttpServletRequest
request, Set<? extends String> namesToSkip) {
- Map<String, Object> attributeMap = FastMap.newInstance();
+ Map<String, Object> attributeMap = new HashMap<String, Object>();
// look at all request attributes
Enumeration<String> requestAttrNames =
UtilGenerics.cast(request.getAttributeNames());
@@ -339,7 +337,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getSessionMap(HttpServletRequest
request, Set<? extends String> namesToSkip) {
- Map<String, Object> sessionMap = FastMap.newInstance();
+ Map<String, Object> sessionMap = new HashMap<String, Object>();
HttpSession session = request.getSession();
// look at all the session attributes
@@ -374,7 +372,7 @@ public class UtilHttp {
* @return The resulting Map
*/
public static Map<String, Object> getServletContextMap(HttpServletRequest
request, Set<? extends String> namesToSkip) {
- Map<String, Object> servletCtxMap = FastMap.newInstance();
+ Map<String, Object> servletCtxMap = new HashMap<String, Object>();
// look at all servlet context attributes
ServletContext servletContext = (ServletContext)
request.getAttribute("servletContext");
@@ -1126,7 +1124,7 @@ public class UtilHttp {
* index of the row.
*/
public static Collection<Map<String, Object>>
parseMultiFormData(Map<String, Object> parameters) {
- FastMap<Integer, Map<String, Object>> rows = FastMap.newInstance(); //
stores the rows keyed by row number
+ Map<Integer, Map<String, Object>> rows = new HashMap<Integer,
Map<String, Object>>(); // stores the rows keyed by row number
// first loop through all the keys and create a hashmap for each
${ROW_SUBMIT_PREFIX}${N} = Y
for (String key: parameters.keySet()) {
@@ -1138,7 +1136,7 @@ public class UtilHttp {
// decode the value of N and create a new map for it
Integer n = Integer.decode(key.substring(ROW_SUBMIT_PREFIX_LENGTH,
key.length()));
- Map<String, Object> m = FastMap.newInstance();
+ Map<String, Object> m = new HashMap<String, Object>();
m.put("row", n); // special "row" = N tuple
rows.put(n, m); // key it to N
}
@@ -1170,7 +1168,7 @@ public class UtilHttp {
* multi form parameters (usually named according to the ${param}_o_N
notation).
*/
public static <V> Map<String, V> removeMultiFormParameters(Map<String, V>
parameters) {
- FastMap<String, V> filteredParameters = new FastMap<String, V>();
+ Map<String, V> filteredParameters = new HashMap<String, V>();
for (Map.Entry<String, V> entry : parameters.entrySet()) {
String key = entry.getKey();
if (key != null && (key.indexOf(MULTI_ROW_DELIMITER) != -1 ||
key.indexOf("_useRowSubmit") != -1 || key.indexOf("_rowCount") != -1)) {
@@ -1220,7 +1218,7 @@ public class UtilHttp {
if (UtilValidate.isEmpty(compositeType)) return null;
// collect the composite fields into a map
- Map<String, String> data = FastMap.newInstance();
+ Map<String, String> data = new HashMap<String, String>();
for (Enumeration<String> names =
UtilGenerics.cast(request.getParameterNames()); names.hasMoreElements();) {
String name = names.nextElement();
if (!name.startsWith(prefix + COMPOSITE_DELIMITER)) continue;
@@ -1375,7 +1373,7 @@ public class UtilHttp {
HttpSession session = request.getSession();
Map<String, Map<String, Object>> paramMapStore =
UtilGenerics.checkMap(session.getAttribute("_PARAM_MAP_STORE_"));
if (paramMapStore == null) {
- paramMapStore = FastMap.newInstance();
+ paramMapStore = new HashMap<String, Map<String, Object>>();
session.setAttribute("_PARAM_MAP_STORE_", paramMapStore);
}
Map<String, Object> parameters = getParameterMap(request);
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilJavaParse.java Fri
Oct 31 19:29:46 2014
@@ -20,10 +20,9 @@ package org.ofbiz.base.util;
import java.io.File;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
-import javolution.util.FastSet;
-
import org.ofbiz.base.component.ComponentConfig;
@@ -117,7 +116,8 @@ public class UtilJavaParse {
return nextClose;
}
- public static Set<String> serviceMethodNames = FastSet.newInstance();
+ // FIXME: Not thread safe
+ public static Set<String> serviceMethodNames = new HashSet<String>();
static {
serviceMethodNames.add("runSync");
serviceMethodNames.add("runSyncIgnore");
@@ -129,7 +129,7 @@ public class UtilJavaParse {
serviceMethodNames.add("addCommitService");
}
public static Set<String> findServiceCallsInBlock(int blockStart, int
blockEnd, String javaFile) {
- Set<String> serviceNameSet = FastSet.newInstance();
+ Set<String> serviceNameSet = new HashSet<String>();
int dispatcherIndex = javaFile.indexOf("dispatcher.", blockStart+1);
while (dispatcherIndex > 0 && dispatcherIndex < blockEnd) {
@@ -154,7 +154,8 @@ public class UtilJavaParse {
return serviceNameSet;
}
- public static Set<String> entityMethodNames = FastSet.newInstance();
+ // FIXME: Not thread safe
+ public static Set<String> entityMethodNames = new HashSet<String>();
static {
entityMethodNames.add("getModelEntity");
entityMethodNames.add("getEntityGroupName");
@@ -197,7 +198,7 @@ public class UtilJavaParse {
entityMethodNames.add("findCountByCondition");
}
public static Set<String> findEntityUseInBlock(int blockStart, int
blockEnd, String javaFile) {
- Set<String> entityNameSet = FastSet.newInstance();
+ Set<String> entityNameSet = new HashSet<String>();
int delegatorIndex = javaFile.indexOf("delegator.", blockStart+1);
while (delegatorIndex > 0 && delegatorIndex < blockEnd) {
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Fri
Oct 31 19:29:46 2014
@@ -29,9 +29,12 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URL;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashSet;
import java.util.InvalidPropertiesFormatException;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -40,9 +43,6 @@ import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
-import javolution.util.FastList;
-import javolution.util.FastSet;
-
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.cache.UtilCache;
import org.ofbiz.base.util.collections.ResourceBundleMapWrapper;
@@ -78,7 +78,7 @@ public class UtilProperties implements S
protected static Locale fallbackLocale = null;
protected static Set<Locale> defaultCandidateLocales = null;
- protected static Set<String> propertiesNotFound = FastSet.newInstance();
+ protected static Set<String> propertiesNotFound = new HashSet<String>();
/** Compares the specified property to the compareString, returns true if
they are the same, false otherwise
* @param resource The name of the resource - if the properties file is
'webevent.properties', the resource name is 'webevent'
@@ -658,7 +658,7 @@ public class UtilProperties implements S
return getMessage(resource, name, UtilGenerics.toMap(String.class,
context), locale);
}
- protected static Set<String> resourceNotFoundMessagesShown =
FastSet.newInstance();
+ protected static Set<String> resourceNotFoundMessagesShown = new
HashSet<String>();
/** Returns the specified resource/properties file as a ResourceBundle
* @param resource The name of the resource - can be a file, class, or URL
* @param locale The locale that the given resource will correspond to
@@ -777,7 +777,7 @@ public class UtilProperties implements S
* @return A list of candidate locales.
*/
public static List<Locale> localeToCandidateList(Locale locale) {
- List<Locale> localeList = FastList.newInstance();
+ List<Locale> localeList = new LinkedList<Locale>();
localeList.add(locale);
String localeString = locale.toString();
int pos = localeString.lastIndexOf("_", localeString.length());
@@ -798,7 +798,7 @@ public class UtilProperties implements S
if (defaultCandidateLocales == null) {
synchronized (UtilProperties.class) {
if (defaultCandidateLocales == null) {
- defaultCandidateLocales = FastSet.newInstance();
+ defaultCandidateLocales = new HashSet<Locale>();
defaultCandidateLocales.addAll(localeToCandidateList(Locale.getDefault()));
defaultCandidateLocales.addAll(localeToCandidateList(getFallbackLocale()));
defaultCandidateLocales.add(Locale.ROOT);
@@ -822,11 +822,10 @@ public class UtilProperties implements S
if (Locale.ROOT.equals(locale)) {
return UtilMisc.toList(locale);
}
- Set<Locale> localeSet = FastSet.newInstance();
+ Set<Locale> localeSet = new HashSet<Locale>();
localeSet.addAll(localeToCandidateList(locale));
localeSet.addAll(getDefaultCandidateLocales());
- List<Locale> localeList = FastList.newInstance();
- localeList.addAll(localeSet);
+ List<Locale> localeList = new ArrayList<Locale>(localeSet);
return localeList;
}
@@ -1036,11 +1035,11 @@ public class UtilProperties implements S
if (bundle == null) {
synchronized (bundleCache) {
double startTime = System.currentTimeMillis();
- FastList<Locale> candidateLocales = (FastList<Locale>)
getCandidateLocales(locale);
+ List<Locale> candidateLocales = (List<Locale>)
getCandidateLocales(locale);
UtilResourceBundle parentBundle = null;
int numProperties = 0;
while (candidateLocales.size() > 0) {
- Locale candidateLocale = candidateLocales.removeLast();
+ Locale candidateLocale =
candidateLocales.remove(candidateLocales.size() -1);
// ResourceBundles are connected together as a
singly-linked list
String lookupName = createResourceName(resource,
candidateLocale, true);
UtilResourceBundle lookupBundle =
bundleCache.get(lookupName);
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilTimer.java Fri Oct
31 19:29:46 2014
@@ -18,7 +18,7 @@
*******************************************************************************/
package org.ofbiz.base.util;
-import javolution.util.FastMap;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Timer handling utility
@@ -30,10 +30,7 @@ import javolution.util.FastMap;
public class UtilTimer {
public static final String module = UtilTimer.class.getName();
- protected static FastMap<String, UtilTimer> staticTimers =
FastMap.newInstance();
- static {
- staticTimers.setShared(true);
- }
+ protected static ConcurrentHashMap<String, UtilTimer> staticTimers = new
ConcurrentHashMap<String, UtilTimer>();
protected String timerName = null;
protected String lastMessage = null;
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java Fri Oct 31
19:29:46 2014
@@ -29,6 +29,7 @@ import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.net.URL;
+import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
@@ -45,8 +46,6 @@ import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import javolution.util.FastList;
-
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.xni.Augmentations;
import org.apache.xerces.xni.NamespaceContext;
@@ -666,7 +665,7 @@ public class UtilXml {
public static List<? extends Element> childElementList(Element element) {
if (element == null) return null;
- List<Element> elements = FastList.newInstance();
+ List<Element> elements = new LinkedList<Element>();
Node node = element.getFirstChild();
if (node != null) {
@@ -686,7 +685,7 @@ public class UtilXml {
public static List<? extends Element> childElementList(Element element,
String childElementName) {
if (element == null) return null;
- List<Element> elements = FastList.newInstance();
+ List<Element> elements = new LinkedList<Element>();
Node node = element.getFirstChild();
if (node != null) {
@@ -708,7 +707,7 @@ public class UtilXml {
public static List<? extends Element> childElementList(Element element,
Set<String> childElementNames) {
if (element == null) return null;
- List<Element> elements = FastList.newInstance();
+ List<Element> elements = new LinkedList<Element>();
if (childElementNames == null) return elements;
Node node = element.getFirstChild();
@@ -733,7 +732,7 @@ public class UtilXml {
/** Return a List of Element objects that are children of the given
DocumentFragment */
public static List<? extends Element> childElementList(DocumentFragment
fragment) {
if (fragment == null) return null;
- List<Element> elements = FastList.newInstance();
+ List<Element> elements = new LinkedList<Element>();
Node node = fragment.getFirstChild();
if (node != null) {
do {
@@ -751,7 +750,7 @@ public class UtilXml {
public static List<? extends Node> childNodeList(Node node) {
if (node == null) return null;
- List<Node> nodes = FastList.newInstance();
+ List<Node> nodes = new LinkedList<Node>();
do {
if (node.getNodeType() == Node.ELEMENT_NODE || node.getNodeType()
== Node.COMMENT_NODE) {
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Fri
Oct 31 19:29:46 2014
@@ -23,8 +23,10 @@ import java.io.NotSerializableException;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
@@ -37,8 +39,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import javolution.util.FastList;
-import javolution.util.FastMap;
import jdbm.helper.FastIterator;
import jdbm.htree.HTree;
@@ -475,7 +475,7 @@ public class UtilCache<K, V> implements
public Collection<V> values() {
if (fileTable != null) {
- List<V> values = FastList.newInstance();
+ List<V> values = new LinkedList<V>();
try {
synchronized (this) {
FastIterator<V> iter = fileTable.values();
@@ -490,7 +490,7 @@ public class UtilCache<K, V> implements
}
return values;
} else {
- List<V> valuesList = FastList.newInstance();
+ List<V> valuesList = new LinkedList<V>();
for (CacheLine<V> line: memoryTable.values()) {
valuesList.add(line.getValue());
}
@@ -896,7 +896,7 @@ public class UtilCache<K, V> implements
}
private Map<String, Object> createLineInfo(int keyNum, K key, CacheLine<V>
line) {
- Map<String, Object> lineInfo = FastMap.newInstance();
+ Map<String, Object> lineInfo = new HashMap<String, Object>();
lineInfo.put("elementKey", key);
if (line.getLoadTimeNanos() > 0) {
@@ -908,7 +908,7 @@ public class UtilCache<K, V> implements
}
private Map<String, Object> createLineInfo(int keyNum, K key, V value) {
- Map<String, Object> lineInfo = FastMap.newInstance();
+ Map<String, Object> lineInfo = new HashMap<String, Object>();
lineInfo.put("elementKey", key);
lineInfo.put("lineSize", findSizeInBytes(value));
lineInfo.put("keyNum", keyNum);
@@ -916,7 +916,7 @@ public class UtilCache<K, V> implements
}
public Collection<? extends Map<String, Object>> getLineInfos() {
- List<Map<String, Object>> lineInfos = FastList.newInstance();
+ List<Map<String, Object>> lineInfos = new LinkedList<Map<String,
Object>>();
int keyIndex = 0;
for (K key: getCacheLineKeys()) {
Object nulledKey = fromKey(key);
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java
Fri Oct 31 19:29:46 2014
@@ -20,11 +20,10 @@ package org.ofbiz.base.util.collections;
import java.util.Collection;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import javolution.util.FastList;
-
public abstract class GenericMapCollection<K, V, M extends Map<K, V>, I>
implements Collection<I> {
protected final M source;
@@ -87,7 +86,7 @@ public abstract class GenericMapCollecti
}
public Object[] toArray() {
- List<I> list = FastList.newInstance();
+ List<I> list = new LinkedList<I>();
Iterator<I> it = iterator(false);
while (it.hasNext()) {
list.add(it.next());
@@ -96,7 +95,7 @@ public abstract class GenericMapCollecti
}
public <T> T[] toArray(T[] array) {
- List<Object> list = FastList.newInstance();
+ List<Object> list = new LinkedList<Object>();
Iterator<I> it = iterator(false);
while (it.hasNext()) {
list.add(it.next());
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapContext.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapContext.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapContext.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapContext.java
Fri Oct 31 19:29:46 2014
@@ -20,17 +20,14 @@ package org.ofbiz.base.util.collections;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import javolution.context.ObjectFactory;
-import javolution.lang.Reusable;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-import javolution.util.FastSet;
-
import org.ofbiz.base.util.UtilGenerics;
@@ -38,19 +35,12 @@ import org.ofbiz.base.util.UtilGenerics;
* Map Stack
*
*/
-public class MapContext<K, V> implements Map<K, V>, Reusable, LocalizedMap<V> {
+public class MapContext<K, V> implements Map<K, V>, LocalizedMap<V> {
public static final String module = MapContext.class.getName();
- protected static final ObjectFactory<MapContext<?, ?>> mapStackFactory =
new ObjectFactory<MapContext<?, ?>>() {
- @Override
- protected MapContext<?, ?> create() {
- return new MapContext<Object, Object>();
- }
- };
-
public static final <K, V> MapContext<K, V> getMapContext() {
- return (MapContext<K, V>) UtilGenerics.<K,
V>checkMap(mapStackFactory.object());
+ return new MapContext<K, V>();
}
public static <K, V> MapContext<K, V> createMapContext() {
@@ -82,15 +72,15 @@ public class MapContext<K, V> implements
super();
}
- protected List<Map<K, V>> stackList = FastList.newInstance();
+ protected List<Map<K, V>> stackList = new LinkedList<Map<K, V>>();
public void reset() {
- stackList = FastList.newInstance();
+ stackList = new LinkedList<Map<K, V>>();
}
/** Puts a new Map on the top of the stack */
public void push() {
- Map<K, V> newMap = FastMap.newInstance();
+ Map<K, V> newMap = new HashMap<K, V>();
this.stackList.add(0,newMap);
}
@@ -184,7 +174,7 @@ public class MapContext<K, V> implements
*/
public boolean containsValue(Object value) {
// walk the stackList and the entries for each Map and if nothing is
in for the current key, consider it an option, otherwise ignore
- Set<K> resultKeySet = FastSet.newInstance();
+ Set<K> resultKeySet = new HashSet<K>();
for (Map<K, V> curMap: this.stackList) {
for (Map.Entry<K, V> curEntry: curMap.entrySet()) {
if (!resultKeySet.contains(curEntry.getKey())) {
@@ -277,7 +267,7 @@ public class MapContext<K, V> implements
*/
public Set<K> keySet() {
// walk the stackList and aggregate all keys
- Set<K> resultSet = FastSet.newInstance();
+ Set<K> resultSet = new HashSet<K>();
for (Map<K, V> curMap: this.stackList) {
resultSet.addAll(curMap.keySet());
}
@@ -289,8 +279,8 @@ public class MapContext<K, V> implements
*/
public Collection<V> values() {
// walk the stackList and the entries for each Map and if nothing is
in for the current key, put it in
- Set<K> resultKeySet = FastSet.newInstance();
- List<V> resultValues = FastList.newInstance();
+ Set<K> resultKeySet = new HashSet<K>();
+ List<V> resultValues = new LinkedList<V>();
for (Map<K, V> curMap: this.stackList) {
for (Map.Entry<K, V> curEntry: curMap.entrySet()) {
if (!resultKeySet.contains(curEntry.getKey())) {
@@ -307,8 +297,8 @@ public class MapContext<K, V> implements
*/
public Set<Map.Entry<K, V>> entrySet() {
// walk the stackList and the entries for each Map and if nothing is
in for the current key, put it in
- Set<K> resultKeySet = FastSet.newInstance();
- Set<Map.Entry<K, V>> resultEntrySet = FastSet.newInstance();
+ Set<K> resultKeySet = new HashSet<K>();
+ Set<Map.Entry<K, V>> resultEntrySet = new HashSet<Map.Entry<K, V>>();
for (Map<K, V> curMap: this.stackList) {
for (Map.Entry<K, V> curEntry: curMap.entrySet()) {
if (!resultKeySet.contains(curEntry.getKey())) {
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapStack.java
Fri Oct 31 19:29:46 2014
@@ -21,11 +21,7 @@ package org.ofbiz.base.util.collections;
import java.util.Locale;
import java.util.Map;
-import javolution.context.ObjectFactory;
-
import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilGenerics;
-
/**
* Map Stack
@@ -35,19 +31,8 @@ public class MapStack<K> extends MapCont
public static final String module = MapStack.class.getName();
- protected static final ObjectFactory<MapStack<?>> mapStackFactory = new
ObjectFactory<MapStack<?>>() {
- @Override
- protected MapStack<?> create() {
- return new MapStack<Object>();
- }
- };
-
- protected static final <K> MapStack<K> getMapStack() {
- return (MapStack<K>) UtilGenerics.<K,
Object>checkMap(mapStackFactory.object());
- }
-
public static <K> MapStack<K> create() {
- MapStack<K> newValue = MapStack.getMapStack();
+ MapStack<K> newValue = new MapStack<K>();
// initialize with a single entry
newValue.push();
return newValue;
@@ -55,7 +40,7 @@ public class MapStack<K> extends MapCont
@SuppressWarnings("unchecked")
public static <K> MapStack<K> create(Map<K, Object> baseMap) {
- MapStack<K> newValue = MapStack.getMapStack();
+ MapStack<K> newValue = new MapStack<K>();
if (baseMap instanceof MapStack) {
newValue.stackList.addAll(((MapStack) baseMap).stackList);
} else {
@@ -66,7 +51,7 @@ public class MapStack<K> extends MapCont
/** Does a shallow copy of the internal stack of the passed MapStack;
enables simultaneous stacks that share common parent Maps */
public static <K> MapStack<K> create(MapStack<K> source) {
- MapStack<K> newValue = MapStack.getMapStack();
+ MapStack<K> newValue = new MapStack<K>();
newValue.stackList.addAll(source.stackList);
return newValue;
}
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/NodeELResolver.java
Fri Oct 31 19:29:46 2014
@@ -19,6 +19,7 @@
package org.ofbiz.base.util.string;
import java.beans.FeatureDescriptor;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -32,8 +33,6 @@ import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import javolution.util.FastList;
-
import org.apache.xerces.dom.NodeImpl;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.cache.UtilCache;
@@ -103,7 +102,7 @@ public class NodeELResolver extends ELRe
} else if (nodeList.getLength() == 1) {
result = nodeList.item(0);
} else {
- List<Node> newList = FastList.newInstance();
+ List<Node> newList = new
ArrayList<Node>(nodeList.getLength());
for (int i = 0; i < nodeList.getLength(); i++) {
newList.add(nodeList.item(i));
}
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelFunctions.java
Fri Oct 31 19:29:46 2014
@@ -28,6 +28,7 @@ import java.net.URL;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
@@ -36,8 +37,6 @@ import javax.el.FunctionMapper;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
-import javolution.util.FastMap;
-
import org.cyberneko.html.parsers.DOMParser;
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.Debug;
@@ -165,7 +164,7 @@ public class UelFunctions {
}
protected static class Functions extends FunctionMapper {
- protected final Map<String, Method> functionMap =
FastMap.newInstance();
+ protected final Map<String, Method> functionMap = new HashMap<String,
Method>();
public Functions() {
try {
this.functionMap.put("date:second",
UtilDateTime.class.getMethod("getSecond", Timestamp.class, TimeZone.class,
Locale.class));
@@ -305,7 +304,7 @@ public class UelFunctions {
return dateFormat.format(stamp);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public static int getSize(Object obj) {
try {
Map map = (Map) obj;
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/UelUtil.java Fri
Oct 31 19:29:46 2014
@@ -19,6 +19,8 @@
package org.ofbiz.base.util.string;
import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -38,9 +40,6 @@ import javax.el.ResourceBundleELResolver
import javax.el.ValueExpression;
import javax.el.VariableMapper;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilGenerics;
@@ -453,6 +452,7 @@ public class UelUtil {
* @param property Property <code>Object</code> to be evaluated
* @return New <code>List</code> or <code>Map</code>
*/
+ @SuppressWarnings("rawtypes")
public static Object autoVivifyListOrMap(Object property) {
String str = property.toString();
boolean isList = ("add".equals(str) || str.startsWith("insert@"));
@@ -461,9 +461,9 @@ public class UelUtil {
isList = (index != null);
}
if (isList) {
- return FastList.newInstance();
+ return new LinkedList();
} else {
- return FastMap.newInstance();
+ return new HashMap();
}
}
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1635846&r1=1635845&r2=1635846&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
Fri Oct 31 19:29:46 2014
@@ -31,7 +31,9 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -42,9 +44,6 @@ import java.util.TimeZone;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
@@ -474,7 +473,7 @@ public class FreeMarkerWorker {
public static void checkForLoop(String path, Map<String, Object> ctx)
throws IOException {
List<String> templateList =
UtilGenerics.checkList(ctx.get("templateList"));
if (templateList == null) {
- templateList = FastList.newInstance();
+ templateList = new LinkedList<String>();
} else {
if (templateList.contains(path)) {
throw new IOException(path + " has already been visited.");
@@ -485,7 +484,7 @@ public class FreeMarkerWorker {
}
public static Map<String, Object> createEnvironmentMap(Environment env) {
- Map<String, Object> templateRoot = FastMap.newInstance();
+ Map<String, Object> templateRoot = new HashMap<String, Object>();
Set<String> varNames = null;
try {
varNames = UtilGenerics.checkSet(env.getKnownVariableNames());
@@ -517,7 +516,7 @@ public class FreeMarkerWorker {
}
public static Map<String, Object> saveValues(Map<String, Object> context,
String [] saveKeyNames) {
- Map<String, Object> saveMap = FastMap.newInstance();
+ Map<String, Object> saveMap = new HashMap<String, Object>();
for (String key: saveKeyNames) {
Object o = context.get(key);
if (o instanceof Map<?, ?>) {