Fixed: Fix Default or Empty Catch block in Java and Groovy files

(OFBIZ-8341)

While reviewing r1812057 I spotted a bunch of swallowed ClassCastExceptions

I then reviewed all ClassCastExceptions and this fixes all of them with a 
minimal logging

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1815797 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2017-11-20 12:32:44 +00:00
parent 3933ba15c0
commit c1a11e83ae
5 changed files with 43 additions and 9 deletions
@@ -26,8 +26,10 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilProperties;
import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
import org.apache.ofbiz.service.calendar.TemporalExpressions.Frequency;
/**
* Generic ResourceBundle Map Wrapper, given ResourceBundle allows it to be used as a Map
@@ -36,6 +38,7 @@ import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
@SuppressWarnings("serial")
public class ResourceBundleMapWrapper implements Map<String, Object>, Serializable {
public static final String module = Frequency.class.getName();
protected MapStack<String> rbmwStack;
protected ResourceBundle initialResourceBundle;
protected Map<String, Object> context;
@@ -122,8 +125,8 @@ public class ResourceBundleMapWrapper implements Map<String, Object>, Serializab
try {
String str = (String) value;
return FlexibleStringExpander.expandString(str, context);
} catch (Exception e) {
// Potential ClassCastException - do nothing
} catch (ClassCastException e) {
Debug.logInfo(e.getMessage(), module);
}
}
return value;
@@ -248,7 +248,9 @@ public final class UelUtil {
try {
ReadOnlyExpression other = (ReadOnlyExpression) obj;
return this.object.equals(other.object);
} catch (ClassCastException e) {}
} catch (ClassCastException e) {
Debug.logInfo(e.getMessage(), module);
}
return false;
}
@@ -285,7 +287,9 @@ public final class UelUtil {
try {
BasicValueExpression other = (BasicValueExpression) obj;
return this.varName.equals(other.varName);
} catch (ClassCastException e) {}
} catch (ClassCastException e) {
Debug.logInfo(e.getMessage(), module);
}
return false;
}
@Override
@@ -342,7 +346,9 @@ public final class UelUtil {
BasicContext elContext = (BasicContext) context;
elContext.variables.put(property.toString(), val);
context.setPropertyResolved(true);
} catch (ClassCastException e) {}
} catch (ClassCastException e) {
Debug.logInfo(e.getMessage(), module);
}
}
}
}