Improved: Clean up commented out code in Java source for Base component.
(OFBIZ-8036) Thanks: Harsh for the contribution. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1761200 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
-1
@@ -41,7 +41,6 @@ public class JustLoadComponentsContainer implements Container {
|
||||
Debug.logError(e, module);
|
||||
} catch (ComponentException e) {
|
||||
Debug.logError(e, module);
|
||||
//throw UtilMisc.initCause(new ContainerException(e.getMessage()), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,5 @@ public class DateTimeTests extends GenericTestCaseBase {
|
||||
assertConversion("LongToTimestamp", new DateTimeConverters.NumberToTimestamp(), longTime, timestamp);
|
||||
// Source class = java.lang.String
|
||||
assertConversion("StringToTimestamp", new DateTimeConverters.StringToTimestamp(), timestamp.toString(), timestamp);
|
||||
//assertConversion("StringToDate", new DateTimeConverters.StringToDate(), utilDate.toString(), utilDate);
|
||||
//assertConversion("StringToSqlDate", new DateTimeConverters.StringToSqlDate(), sqlDate.toString(), sqlDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ public class AliasKeyManager implements X509KeyManager {
|
||||
for (String alias: aliases) {
|
||||
if (this.alias.equals(alias)) {
|
||||
if (Debug.verboseOn()) Debug.logVerbose("chooseClientAlias for keyType [" + keyType + "] got alias " + this.alias, module);
|
||||
//Debug.logInfo(new Exception(), "Location where chooseClientAlias is called", module);
|
||||
return this.alias;
|
||||
}
|
||||
}
|
||||
@@ -82,7 +81,6 @@ public class AliasKeyManager implements X509KeyManager {
|
||||
public PrivateKey getPrivateKey(String alias) {
|
||||
PrivateKey pk = keyManager.getPrivateKey(alias);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("getPrivateKey for alias [" + alias + "] got " + (pk == null ? "[Not Found!]" : "[alg:" + pk.getAlgorithm() + ";format:" + pk.getFormat() + "]"), module);
|
||||
//Debug.logInfo(new Exception(), "Location where getPrivateKey is called", module);
|
||||
return pk;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,12 +109,6 @@ public class HttpRequestFileUpload {
|
||||
public void doUpload(HttpServletRequest request) throws IOException {
|
||||
ServletInputStream in = request.getInputStream();
|
||||
|
||||
/* System.out.println("Header:");
|
||||
Enumeration ee = request.getHeaderNames();
|
||||
while (ee.hasMoreElements()) {
|
||||
String ss = (String)ee.nextElement();
|
||||
System.out.println(ss + " = [" + request.getHeader(ss) + "]");
|
||||
}*/
|
||||
String reqLengthString = request.getHeader("content-length");
|
||||
|
||||
System.out.println("expect " + reqLengthString + " bytes.");
|
||||
@@ -232,7 +226,6 @@ public class HttpRequestFileUpload {
|
||||
int pos = newLine.indexOf("name=\"");
|
||||
String fieldName = newLine.substring(pos + 6, newLine.length() - 3);
|
||||
|
||||
// System.out.println("fieldName:" + fieldName);
|
||||
// blank line
|
||||
i = waitingReadLine(in, line, 0, BUFFER_SIZE, requestLength);
|
||||
requestLength -= i;
|
||||
@@ -255,7 +248,6 @@ public class HttpRequestFileUpload {
|
||||
fieldValue.append(newLine);
|
||||
newLine = new String(line, 0, i);
|
||||
}
|
||||
// System.out.println("fieldValue:" + fieldValue.toString());
|
||||
fields.put(fieldName, fieldValue.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +334,6 @@ public class ObjectType {
|
||||
* @return true if objectClass is a class of or a sub-class of the parent
|
||||
*/
|
||||
public static boolean isOrSubOf(Class<?> objectClass, Class<?> parentClass) {
|
||||
//Debug.logInfo("Checking isOrSubOf for [" + objectClass.getName() + "] and [" + objectClass.getName() + "]", module);
|
||||
while (objectClass != null) {
|
||||
if (objectClass == parentClass) return true;
|
||||
objectClass = objectClass.getSuperclass();
|
||||
@@ -420,7 +419,6 @@ public class ObjectType {
|
||||
}
|
||||
|
||||
public static Class<?> loadInfoClass(String typeName, ClassLoader loader) {
|
||||
//Class infoClass = null;
|
||||
try {
|
||||
return loadClass(typeName, loader);
|
||||
} catch (SecurityException se1) {
|
||||
|
||||
@@ -831,7 +831,6 @@ public final class UtilDateTime {
|
||||
Timestamp retStamp = new Timestamp(tempCal.getTimeInMillis());
|
||||
retStamp.setNanos(0);
|
||||
//MSSQL datetime field has accuracy of 3 milliseconds and setting the nano seconds cause the date to be rounded to next day
|
||||
//retStamp.setNanos(999999999);
|
||||
return retStamp;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,6 @@ public final class UtilFormatOut {
|
||||
* @return A String with the formatted price
|
||||
*/
|
||||
public static String formatCurrency(double price, String isoCode, Locale locale, int maximumFractionDigits) {
|
||||
//Debug.logInfo("formatting currency: " + price + ", isoCode: " + isoCode + ", locale: " + locale, module);
|
||||
com.ibm.icu.text.NumberFormat nf = com.ibm.icu.text.NumberFormat.getCurrencyInstance(locale);
|
||||
if (isoCode != null && isoCode.length() > 1) {
|
||||
nf.setCurrency(com.ibm.icu.util.Currency.getInstance(isoCode));
|
||||
@@ -159,7 +158,6 @@ public final class UtilFormatOut {
|
||||
* @return A String with the formatted number
|
||||
*/
|
||||
public static String formatSpelledOutAmount(double amount, Locale locale) {
|
||||
//Debug.logInfo("formatting currency: " + price + ", isoCode: " + isoCode + ", locale: " + locale, module);
|
||||
com.ibm.icu.text.NumberFormat nf = new com.ibm.icu.text.RuleBasedNumberFormat(locale, com.ibm.icu.text.RuleBasedNumberFormat.SPELLOUT);
|
||||
return nf.format(amount);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,6 @@ public final class UtilHttp {
|
||||
String token = queryTokens.nextToken();
|
||||
if (token.startsWith("amp;")) {
|
||||
// this is most likely a split value that had an & in it, so don't consider this a name; note that some old code just stripped the "amp;" and went with it
|
||||
//token = token.substring(4);
|
||||
continue;
|
||||
}
|
||||
int equalsIndex = token.indexOf("=");
|
||||
@@ -836,18 +835,8 @@ public final class UtilHttp {
|
||||
}
|
||||
}
|
||||
buf.append(UtilCodec.getEncoder("url").encode(name));
|
||||
/* the old way: try {
|
||||
buf.append(URLEncoder.encode(name, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Debug.logError(e, module);
|
||||
} */
|
||||
buf.append('=');
|
||||
buf.append(UtilCodec.getEncoder("url").encode(valueStr));
|
||||
/* the old way: try {
|
||||
buf.append(URLEncoder.encode(valueStr, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Debug.logError(e, module);
|
||||
} */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,6 @@ public final class UtilJavaParse {
|
||||
if (endOfSubBlock < 0) return -1;
|
||||
nextOpen = javaFile.indexOf("{", endOfSubBlock+1);
|
||||
nextClose = javaFile.indexOf("}", endOfSubBlock+1);
|
||||
//Debug.logInfo("In loop in findEndOfBlock for nextOpen=" + nextOpen + ", nextClose=" + nextClose + ", endOfSubBlock=" + endOfSubBlock, module);
|
||||
}
|
||||
|
||||
// at this point there should be no nextOpen or nextOpen is after the nextClose, meaning we're at the end of the block
|
||||
@@ -187,7 +186,6 @@ public final class UtilJavaParse {
|
||||
if (openQuoteIndex - openParenIndex <= 3 && openQuoteIndex >= 0 && closeQuoteIndex >= 0) {
|
||||
//more than two spaces/chars between quote and open paren... consider it something other than what we are looking for
|
||||
String serviceName = javaFile.substring(openQuoteIndex+1, closeQuoteIndex).trim();
|
||||
//Debug.logInfo("In findServiceCallsInBlock found serviceName [" + serviceName + "]", module);
|
||||
serviceNameSet.add(serviceName);
|
||||
}
|
||||
}
|
||||
@@ -213,7 +211,6 @@ public final class UtilJavaParse {
|
||||
if (openQuoteIndex - openParenIndex <= 3 && openQuoteIndex >= 0 && closeQuoteIndex >= 0) {
|
||||
//more than two spaces/chars between quote and open paren... consider it something other than what we are looking for
|
||||
String entityName = javaFile.substring(openQuoteIndex+1, closeQuoteIndex).trim();
|
||||
//Debug.logInfo("In findServiceCallsInBlock found valid entityName [" + entityName + "]", module);
|
||||
entityNameSet.add(entityName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,8 +150,6 @@ public final class UtilMisc {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <K, V> Map<String, V> toMap(Object... data) {
|
||||
if (data.length == 1 && data[0] instanceof Map) {
|
||||
// Logging a warning here because a lot of code misuses this method and that code needs to be fixed.
|
||||
//Debug.logWarning("UtilMisc.toMap called with a Map. Use UtilGenerics.checkMap instead.", module);
|
||||
return UtilGenerics.<String, V>checkMap(data[0]);
|
||||
}
|
||||
if (data.length % 2 == 1) {
|
||||
@@ -223,13 +221,6 @@ public final class UtilMisc {
|
||||
}
|
||||
}
|
||||
for (String keyToRemove: keysToRemove) { map.remove(keyToRemove); }
|
||||
//if (!(map instanceof Serializable)) {
|
||||
// Debug.logInfo("Parameter Map is not Serializable!", module);
|
||||
//}
|
||||
|
||||
//for (Map.Entry<String, V> mapEntry: map.entrySet()) {
|
||||
// Debug.logInfo("Entry in Map made serializable: " + mapEntry.getKey() + "=" + mapEntry.getValue(), module);
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -592,7 +592,7 @@ public final class UtilProperties implements Serializable {
|
||||
try {
|
||||
value = bundle.getString(name);
|
||||
} catch (Exception e) {
|
||||
//Debug.logInfo(e, module);
|
||||
Debug.logInfo(e, module);
|
||||
}
|
||||
return value == null ? name : value.trim();
|
||||
}
|
||||
|
||||
@@ -181,15 +181,9 @@ public class UtilTimer {
|
||||
retStringBuf.append("(");
|
||||
|
||||
String timeSinceStartStr = String.valueOf(timeSinceStart());
|
||||
|
||||
// int spacecount = 5 - timeSinceStartStr.length();
|
||||
// for (int i=0; i < spacecount; i++) { retStringBuf.append(' '); }
|
||||
retStringBuf.append(timeSinceStartStr + ",");
|
||||
|
||||
String timeSinceLastStr = String.valueOf(timeSinceLast());
|
||||
|
||||
// spacecount = 4 - timeSinceLastStr.length();
|
||||
// for (int i=0; i < spacecount; i++) { retStringBuf.append(' '); }
|
||||
retStringBuf.append(timeSinceLastStr);
|
||||
|
||||
retStringBuf.append(")");
|
||||
@@ -200,13 +194,9 @@ public class UtilTimer {
|
||||
}
|
||||
retStringBuf.append(message);
|
||||
|
||||
// lastMessageTime = (new Date()).getTime();
|
||||
lastMessageTime = System.currentTimeMillis();
|
||||
// lastMessage = message;
|
||||
|
||||
String retString = retStringBuf.toString();
|
||||
|
||||
// if (!quiet) Debug.logInfo(retString, module);
|
||||
if (log && Debug.timingOn()) Debug.logTiming(retString, module);
|
||||
return retString;
|
||||
}
|
||||
|
||||
@@ -302,10 +302,6 @@ public final class UtilValidate {
|
||||
/** Returns true if single character c(actually a string) is contained within string s. */
|
||||
public static boolean charInString(char c, String s) {
|
||||
return (s.indexOf(c) != -1);
|
||||
// for (int i = 0; i < s.length; i++) {
|
||||
// if (s.charAt(i) == c) return true;
|
||||
// }
|
||||
// return false;
|
||||
}
|
||||
|
||||
/** Removes initial(leading) whitespace characters from s.
|
||||
@@ -315,7 +311,6 @@ public final class UtilValidate {
|
||||
|
||||
while ((i < s.length()) && charInString(s.charAt(i), whitespace)) i++;
|
||||
return s.substring(i);
|
||||
// return s.substring(i, s.length);
|
||||
}
|
||||
|
||||
/** Returns true if character c is an English letter (A .. Z, a..z).
|
||||
@@ -377,15 +372,6 @@ public final class UtilValidate {
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// int startPos = 0;
|
||||
// boolean secondArg = defaultEmptyOK;
|
||||
|
||||
// if (isSignedInteger.arguments.length > 1) secondArg = isSignedInteger.arguments[1];
|
||||
|
||||
// skip leading + or -
|
||||
// if ((s.charAt(0) == "-") ||(s.charAt(0) == "+")) startPos = 1;
|
||||
// return(isInteger(s.substring(startPos, s.length), secondArg))
|
||||
}
|
||||
|
||||
/** Returns true if all characters are numbers;
|
||||
@@ -415,9 +401,6 @@ public final class UtilValidate {
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return(isSignedInteger(s, secondArg)
|
||||
// &&((isEmpty(s) && secondArg) ||(parseInt(s) > 0)));
|
||||
}
|
||||
|
||||
/** Returns true if string s is an integer >= 0. */
|
||||
@@ -432,9 +415,6 @@ public final class UtilValidate {
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return(isSignedInteger(s, secondArg)
|
||||
// &&((isEmpty(s) && secondArg) ||(parseInt(s) >= 0)));
|
||||
}
|
||||
|
||||
/** Returns true if string s is an integer < 0. */
|
||||
@@ -449,9 +429,6 @@ public final class UtilValidate {
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return(isSignedInteger(s, secondArg)
|
||||
// &&((isEmpty(s) && secondArg) ||(parseInt(s) < 0)));
|
||||
}
|
||||
|
||||
/** Returns true if string s is an integer <= 0. */
|
||||
@@ -466,9 +443,6 @@ public final class UtilValidate {
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return(isSignedInteger(s, secondArg)
|
||||
// &&((isEmpty(s) && secondArg) ||(parseInt(s) <= 0)));
|
||||
}
|
||||
|
||||
/** True if string s is an unsigned floating point(real) number.
|
||||
@@ -570,13 +544,6 @@ public final class UtilValidate {
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//The old way:
|
||||
// int startPos = 0;
|
||||
// if (isSignedFloat.arguments.length > 1) secondArg = isSignedFloat.arguments[1];
|
||||
// skip leading + or -
|
||||
// if ((s.charAt(0) == "-") ||(s.charAt(0) == "+")) startPos = 1;
|
||||
// return(isFloat(s.substring(startPos, s.length), secondArg))
|
||||
}
|
||||
|
||||
/** True if string s is a signed or unsigned floating point
|
||||
|
||||
@@ -422,22 +422,8 @@ public final class UtilXml {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
// DON'T do this: seems to be causing problems with Catalina/Tomcat, maybe it is expecting a different parser?
|
||||
//System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
|
||||
|
||||
Document document = null;
|
||||
|
||||
/* Xerces DOMParser direct interaction; the other seems to be working better than this, so we'll stay with the standard JAXP stuff
|
||||
DOMParser parser = new DOMParser();
|
||||
try {
|
||||
parser.setFeature("http://xml.org/sax/features/validation", true);
|
||||
parser.setFeature("http://apache.org/xml/features/validation/schema", true);
|
||||
} catch (SAXException e) {
|
||||
Debug.logWarning("Could not set parser feature: " + e.toString(), module);
|
||||
}
|
||||
parser.parse(new InputSource(is));
|
||||
document = parser.getDocument();
|
||||
*/
|
||||
|
||||
/* Standard JAXP (mostly), but doesn't seem to be doing XML Schema validation, so making sure that is on... */
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(validate);
|
||||
@@ -447,8 +433,6 @@ public final class UtilXml {
|
||||
factory.setAttribute("http://apache.org/xml/features/validation/schema", validate);
|
||||
|
||||
// with a SchemaUrl, a URL object
|
||||
//factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
|
||||
//factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", SchemaUrl);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
if (validate) {
|
||||
LocalResolver lr = new LocalResolver(new DefaultHandler());
|
||||
@@ -567,8 +551,6 @@ public final class UtilXml {
|
||||
parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);
|
||||
|
||||
// with a SchemaUrl, a URL object
|
||||
//factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
|
||||
//factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", SchemaUrl);
|
||||
if (validate) {
|
||||
LocalResolver lr = new LocalResolver(new DefaultHandler());
|
||||
ErrorHandler eh = new LocalErrorHandler(docDescription, lr);
|
||||
@@ -595,7 +577,6 @@ public final class UtilXml {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
|
||||
factory.setValidating(true);
|
||||
// factory.setNamespaceAware(true);
|
||||
try {
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
|
||||
@@ -1014,7 +995,6 @@ public final class UtilXml {
|
||||
* @return InputSource of DTD
|
||||
*/
|
||||
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
|
||||
//Debug.logInfo("resolving XML entity with publicId [" + publicId + "], systemId [" + systemId + "]", module);
|
||||
hasDTD = false;
|
||||
String dtd = UtilProperties.getSplitPropertyValue(UtilURL.fromResource("localdtds.properties"), publicId);
|
||||
if (UtilValidate.isNotEmpty(dtd)) {
|
||||
@@ -1065,8 +1045,6 @@ public final class UtilXml {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//Debug.logInfo("[UtilXml.LocalResolver.resolveEntity] local resolve failed for DTD with publicId [" +
|
||||
// publicId + "] and the dtd file is [" + dtd + "], trying defaultResolver", module);
|
||||
return defaultResolver.resolveEntity(publicId, systemId);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,6 @@ import org.apache.ofbiz.base.concurrent.ExecutionPool;
|
||||
public abstract class CacheLine<V> extends ExecutionPool.Pulse {
|
||||
protected CacheLine(long loadTimeNanos, long expireTimeNanos) {
|
||||
super(loadTimeNanos, expireTimeNanos);
|
||||
// FIXME: this seems very odd to me (ARH)
|
||||
//if (loadTime <= 0) {
|
||||
// hasExpired = true;
|
||||
//}
|
||||
}
|
||||
|
||||
abstract CacheLine<V> changeLine(boolean useSoftReference, long expireTimeNanos);
|
||||
|
||||
-2
@@ -139,7 +139,6 @@ public final class FlexibleMapAccessor<T> implements Serializable, IsEmpty {
|
||||
}
|
||||
if (locale != null && !base.containsKey(UelUtil.getLocalizedMapLocaleKey())) {
|
||||
// This method is a hot spot, so placing the cast here instead of in another class.
|
||||
// Map<String, Object> writableMap = UtilGenerics.cast(base);
|
||||
Map<String, Object> writableMap = (Map<String, Object>) base;
|
||||
writableMap.put(UelUtil.getLocalizedMapLocaleKey(), locale);
|
||||
}
|
||||
@@ -155,7 +154,6 @@ public final class FlexibleMapAccessor<T> implements Serializable, IsEmpty {
|
||||
Debug.logError("UEL exception while getting value: " + e + ", original = " + this.original, module);
|
||||
}
|
||||
// This method is a hot spot, so placing the cast here instead of in another class.
|
||||
// return UtilGenerics.<T>cast(obj);
|
||||
return (T) obj;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,8 +140,6 @@ public abstract class GenericMap<K, V> implements Appender<StringBuilder>, Map<K
|
||||
@Override
|
||||
protected void noteRemoval(Map.Entry<K, V> dest, Map.Entry<K, V> src) {
|
||||
// No need to note the remove, the wrapped iterator does that for us
|
||||
// evictionPolicy.remove(evictionDeque, dest);
|
||||
// if (diskStore != null) diskStore.remove(dest);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,8 +168,6 @@ public abstract class GenericMap<K, V> implements Appender<StringBuilder>, Map<K
|
||||
@Override
|
||||
protected void noteRemoval(K dest, Map.Entry<K, V> src) {
|
||||
// No need to note the remove, the wrapped iterator does that for us
|
||||
// evictionPolicy.remove(evictionDeque, dest);
|
||||
// if (diskStore != null) diskStore.remove(dest);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,8 +190,6 @@ public abstract class GenericMap<K, V> implements Appender<StringBuilder>, Map<K
|
||||
@Override
|
||||
protected void noteRemoval(V dest, Map.Entry<K, V> src) {
|
||||
// No need to note the remove, the wrapped iterator does that for us
|
||||
// evictionPolicy.remove(evictionDeque, src.getKey());
|
||||
// if (diskStore != null) diskStore.remove(src.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -71,8 +71,6 @@ public class MapComparator implements Comparator<Map<Object, Object>> {
|
||||
FlexibleMapAccessor<Object> fmaKey = UtilGenerics.cast(key);
|
||||
ascending = fmaKey.getIsAscending();
|
||||
|
||||
//Debug.logInfo("Doing compare with a FlexibleMapAccessor [" + fmaKey.getOriginalName() + "] ascending [" + ascending + "]", module);
|
||||
|
||||
o1 = fmaKey.get(UtilGenerics.<String, Object>checkMap(map1));
|
||||
o2 = fmaKey.get(UtilGenerics.<String, Object>checkMap(map2));
|
||||
} else {
|
||||
|
||||
-8
@@ -258,11 +258,6 @@ public class ResourceBundleMapWrapper implements Map<String, Object>, Serializab
|
||||
}
|
||||
}
|
||||
}
|
||||
/* we used to do this here, but now we'll do it in the top-level class since doing it here would prevent searching down the stack
|
||||
if (value == null) {
|
||||
value = arg0;
|
||||
}
|
||||
*/
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -322,8 +317,5 @@ public class ResourceBundleMapWrapper implements Map<String, Object>, Serializab
|
||||
return this.resourceBundle;
|
||||
}
|
||||
|
||||
/*public String toString() {
|
||||
return this.topLevelMap.toString();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -101,7 +101,6 @@ public class GenericMapTest extends GenericTestCaseBase {
|
||||
@Override
|
||||
protected Iterator<Map.Entry<K, V>> iterator(final boolean noteAccess) {
|
||||
incrementCallCount("iterator-" + noteAccess);
|
||||
//return new IteratorWrapper<Map.Entry<K, V>, Map.Entry<K, V>>(noteAccess, proxyMap.entrySet().iterator()) {
|
||||
return new IteratorWrapper<Map.Entry<K, V>, Map.Entry<K, V>>(proxyMap.entrySet().iterator()) {
|
||||
@Override
|
||||
protected Map.Entry<K, V> convert(Map.Entry<K, V> src) {
|
||||
|
||||
-1
@@ -50,7 +50,6 @@ public class FlexibleStringExpanderTests extends TestCase {
|
||||
|
||||
private static void parserTest(String label, String input, boolean checkCache, String toString) {
|
||||
FlexibleStringExpander fse = FlexibleStringExpander.getInstance(input, false);
|
||||
//System.err.println("fse(" + fse + ").class=" + fse.getClass());
|
||||
assertEquals(label + ":toString(no-cache)", toString, fse.toString());
|
||||
fse = FlexibleStringExpander.getInstance(input, true);
|
||||
assertEquals(label + ":toString(cache)", toString, fse.toString());
|
||||
|
||||
+2
-19
@@ -353,7 +353,6 @@ public final class FreeMarkerWorker {
|
||||
}
|
||||
|
||||
public static String getArg(Map<String, ? extends Object> args, String key, Map<String, ? extends Object> templateContext) {
|
||||
//SimpleScalar s = null;
|
||||
Object o = args.get(key);
|
||||
String returnVal = (String) unwrap(o);
|
||||
if (returnVal == null) {
|
||||
@@ -362,14 +361,13 @@ public final class FreeMarkerWorker {
|
||||
returnVal = (String) templateContext.get(key);
|
||||
}
|
||||
} catch (ClassCastException e2) {
|
||||
//return null;
|
||||
Debug.logInfo(e2.getMessage(), module);
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
public static Object getArgObject(Map<String, ? extends Object> args, String key, Map<String, ? extends Object> templateContext) {
|
||||
//SimpleScalar s = null;
|
||||
Object o = args.get(key);
|
||||
Object returnVal = unwrap(o);
|
||||
if (returnVal == null) {
|
||||
@@ -378,7 +376,7 @@ public final class FreeMarkerWorker {
|
||||
returnVal = templateContext.get(key);
|
||||
}
|
||||
} catch (ClassCastException e2) {
|
||||
//return null;
|
||||
Debug.logInfo(e2.getMessage(), module);
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
@@ -448,16 +446,6 @@ public final class FreeMarkerWorker {
|
||||
ctx = UtilGenerics.cast(((BeanModel) ctxObj).getWrappedObject());
|
||||
returnObj = ctx.get(key);
|
||||
}
|
||||
/*
|
||||
try {
|
||||
Map templateContext = (Map) FreeMarkerWorker.getWrappedObject("context", env);
|
||||
if (templateContext != null) {
|
||||
returnObj = (String) templateContext.get(key);
|
||||
}
|
||||
} catch (ClassCastException e2) {
|
||||
//return null;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return returnObj;
|
||||
}
|
||||
@@ -500,9 +488,6 @@ public final class FreeMarkerWorker {
|
||||
}
|
||||
if (varNames != null) {
|
||||
for (String varName: varNames) {
|
||||
//freemarker.ext.beans.StringModel varObj = (freemarker.ext.beans.StringModel) varNameIter.next();
|
||||
//Object varObj = varNameIter.next();
|
||||
//String varName = varObj.toString();
|
||||
templateRoot.put(varName, FreeMarkerWorker.getWrappedObject(varName, env));
|
||||
}
|
||||
}
|
||||
@@ -510,7 +495,6 @@ public final class FreeMarkerWorker {
|
||||
}
|
||||
|
||||
public static void saveContextValues(Map<String, Object> context, String [] saveKeyNames, Map<String, Object> saveMap) {
|
||||
//Map saveMap = new HashMap();
|
||||
for (String key: saveKeyNames) {
|
||||
Object o = context.get(key);
|
||||
if (o instanceof Map<?, ?>) {
|
||||
@@ -564,7 +548,6 @@ public final class FreeMarkerWorker {
|
||||
for (Map.Entry<String, Object> entry: args.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object obj = entry.getValue();
|
||||
//if (Debug.infoOn()) Debug.logInfo("in overrideWithArgs, key(3):" + key + " obj:" + obj + " class:" + obj.getClass().getName() , module);
|
||||
if (obj != null) {
|
||||
if (obj == TemplateModel.NOTHING) {
|
||||
ctx.put(key, null);
|
||||
|
||||
@@ -441,7 +441,6 @@ public class ObjectTypeTests extends GenericTestCaseBase {
|
||||
simpleTypeConvertTestError("TimeZone->error", localeData.goodTimeZone, new String[] {});
|
||||
}
|
||||
|
||||
// GenericValue, org.apache.ofbiz.entity.GenericValue
|
||||
|
||||
public void testMap() throws GeneralException {
|
||||
simpleTypeConvertTestSingleMulti("Map->Map", map, new String[] {"Map", "java.util.Map"}, map("one", "1", "two", "2", "three", "3"));
|
||||
@@ -457,14 +456,6 @@ public class ObjectTypeTests extends GenericTestCaseBase {
|
||||
simpleTypeConvertTestError("List->error", list, new String[] {});
|
||||
}
|
||||
|
||||
/*
|
||||
// java.nio.ByteBuffer
|
||||
|
||||
public void testBuffer() throws GeneralException {
|
||||
CharBuffer cbuf = CharBuffer.wrap("one, two, three");
|
||||
simpleTypeConvertTestSingleMulti("Buffer->ByteBuffer", cbuf, new String[] {"java.nio.ByteBuffer"}, "");
|
||||
}
|
||||
*/
|
||||
|
||||
// Node tests are done for all String-> conversions
|
||||
// org.w3c.dom.Node
|
||||
|
||||
@@ -87,7 +87,6 @@ public class StringUtilTests extends GenericTestCaseBase {
|
||||
|
||||
public void testStrToMap() {
|
||||
assertNull("null-string", StringUtil.strToMap(null, false));
|
||||
//assertEquals("empty", Collections.emptyMap(), StringUtil.strToMap("", false));
|
||||
assertEquals("missing =", Collections.emptyMap(), StringUtil.strToMap("1", false));
|
||||
assertEquals("single", map("1", "one"), StringUtil.strToMap("1=one"));
|
||||
assertEquals("double", map("2", "two", "1", "one"), StringUtil.strToMap("1=one|2=two"));
|
||||
@@ -114,7 +113,6 @@ public class StringUtilTests extends GenericTestCaseBase {
|
||||
assertNotNull("bad(" + s + ")", caught);
|
||||
}
|
||||
}
|
||||
//assertEquals("empty", Collections.emptyMap(), StringUtil.toMap("{}"));
|
||||
assertEquals("single", map("1", "one"), StringUtil.toMap("{1=one}"));
|
||||
assertEquals("double", map("2", "two", "1", "one"), StringUtil.toMap("{1=one, 2=two}"));
|
||||
assertEquals("double-space", map("2", "two ", " 1", "one"), StringUtil.toMap("{ 1=one, 2=two }"));
|
||||
@@ -131,7 +129,6 @@ public class StringUtilTests extends GenericTestCaseBase {
|
||||
assertNotNull("bad(" + s + ")", caught);
|
||||
}
|
||||
}
|
||||
//assertEquals("empty", Collections.emptyList(), StringUtil.toList("[]"));
|
||||
assertEquals("single", list("1"), StringUtil.toList("[1]"));
|
||||
assertEquals("double", list("1", "2"), StringUtil.toList("[1, 2]"));
|
||||
assertEquals("double-space", list(" 1", "2 "), StringUtil.toList("[ 1, 2 ]"));
|
||||
@@ -148,7 +145,6 @@ public class StringUtilTests extends GenericTestCaseBase {
|
||||
assertNotNull("bad(" + s + ")", caught);
|
||||
}
|
||||
}
|
||||
//assertEquals("empty", Collections.emptySet(), StringUtil.toSet("[]"));
|
||||
assertEquals("single", set("1"), StringUtil.toSet("[1]"));
|
||||
assertEquals("double", set("1", "2"), StringUtil.toSet("[1, 2]"));
|
||||
assertEquals("double-space", set(" 1", "2 "), StringUtil.toSet("[ 1, 2 ]"));
|
||||
|
||||
Reference in New Issue
Block a user