A patch from Marc Morin "Resolve java warnings exposed in Eclipse : framework - webapp" (https://issues.apache.org/jira/browse/OFBIZ-3116) - OFBIZ-3116

With few changes notably an enhanced for loop instead of while iterator and


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@836141 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2009-11-14 08:29:42 +00:00
parent 33b6e17262
commit ffdbca925e
32 changed files with 87 additions and 87 deletions
@@ -18,15 +18,16 @@
*******************************************************************************/
package org.ofbiz.webapp.control;
import static org.ofbiz.base.util.UtilGenerics.checkMap;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -46,10 +47,10 @@ import org.ofbiz.base.start.StartupException;
import org.ofbiz.base.util.CachedClassLoader;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import static org.ofbiz.base.util.UtilGenerics.checkMap;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilObject;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
import org.ofbiz.security.Security;
@@ -381,9 +382,9 @@ public class ContextFilter implements Filter {
}
protected void putAllInitParametersInAttributes() {
Enumeration initParamEnum = config.getServletContext().getInitParameterNames();
Enumeration<String> initParamEnum = UtilGenerics.cast(config.getServletContext().getInitParameterNames());
while (initParamEnum.hasMoreElements()) {
String initParamName = (String) initParamEnum.nextElement();
String initParamName = initParamEnum.nextElement();
String initParamValue = config.getServletContext().getInitParameter(initParamName);
if (Debug.verboseOn()) Debug.logVerbose("Adding web.xml context-param to application attribute with name [" + initParamName + "] and value [" + initParamValue + "]", module);
config.getServletContext().setAttribute(initParamName, initParamValue);
@@ -411,7 +412,7 @@ public class ContextFilter implements Filter {
protected Container getContainers() throws ServletException {
Container rmiLoadedContainer = null;
try {
rmiLoadedContainer = ContainerLoader.loadContainers(CONTAINER_CONFIG, null); // used in Geronimo/WASCE to allow to deregister
rmiLoadedContainer = ContainerLoader.loadContainers(CONTAINER_CONFIG, null); // used in Geronimo/WASCE to allow to unregister
} catch (StartupException e) {
Debug.logError(e, module);
throw new ServletException("Unable to load containers; cannot start ContextFilter");
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpSessionListener;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericEntityException;
@@ -146,14 +147,14 @@ public class ControlEventListener implements HttpSessionListener {
Debug.log("Visit Thru : " + visit.getString("thruDate"), module);
Debug.log("--------------------------------------------------------------------", module);
Debug.log("--- Start Session Attributes: ---", module);
Enumeration sesNames = null;
Enumeration<String> sesNames = null;
try {
sesNames = session.getAttributeNames();
sesNames = UtilGenerics.cast(session.getAttributeNames());
} catch (IllegalStateException e) {
Debug.log("Cannot get session attributes : " + e.getMessage(), module);
}
while (sesNames != null && sesNames.hasMoreElements()) {
String attName = (String) sesNames.nextElement();
String attName = sesNames.nextElement();
Debug.log(attName + ":" + session.getAttribute(attName), module);
}
Debug.log("--- End Session Attributes ---", module);
@@ -192,7 +193,7 @@ public class ControlEventListener implements HttpSessionListener {
}
private String getUserLoginSession(HttpSession session) {
Map userLoginSession = (Map) session.getAttribute("userLoginSession");
Map<String, ?> userLoginSession = UtilGenerics.cast(session.getAttribute("userLoginSession"));
String sessionData = null;
if (UtilValidate.isNotEmpty(userLoginSession)) {
@@ -32,6 +32,7 @@ import java.util.Enumeration;
import org.apache.bsf.BSFManager;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilJ2eeCompat;
import org.ofbiz.base.util.UtilTimer;
@@ -346,46 +347,46 @@ public class ControlServlet extends HttpServlet {
HttpSession session = request.getSession();
Debug.logVerbose("--- Start Request Headers: ---", module);
Enumeration headerNames = request.getHeaderNames();
Enumeration<String> headerNames = UtilGenerics.cast(request.getHeaderNames());
while (headerNames.hasMoreElements()) {
String headerName = (String) headerNames.nextElement();
String headerName = headerNames.nextElement();
Debug.logVerbose(headerName + ":" + request.getHeader(headerName), module);
}
Debug.logVerbose("--- End Request Headers: ---", module);
Debug.logVerbose("--- Start Request Parameters: ---", module);
Enumeration paramNames = request.getParameterNames();
Enumeration<String> paramNames = UtilGenerics.cast(request.getParameterNames());
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String paramName = paramNames.nextElement();
Debug.logVerbose(paramName + ":" + request.getParameter(paramName), module);
}
Debug.logVerbose("--- End Request Parameters: ---", module);
Debug.logVerbose("--- Start Request Attributes: ---", module);
Enumeration reqNames = request.getAttributeNames();
Enumeration<String> reqNames = UtilGenerics.cast(request.getAttributeNames());
while (reqNames != null && reqNames.hasMoreElements()) {
String attName = (String) reqNames.nextElement();
String attName = reqNames.nextElement();
Debug.logVerbose(attName + ":" + request.getAttribute(attName), module);
}
Debug.logVerbose("--- End Request Attributes ---", module);
Debug.logVerbose("--- Start Session Attributes: ---", module);
Enumeration sesNames = null;
Enumeration<String> sesNames = null;
try {
sesNames = session.getAttributeNames();
sesNames = UtilGenerics.cast(session.getAttributeNames());
} catch (IllegalStateException e) {
Debug.logVerbose("Cannot get session attributes : " + e.getMessage(), module);
}
while (sesNames != null && sesNames.hasMoreElements()) {
String attName = (String) sesNames.nextElement();
String attName = sesNames.nextElement();
Debug.logVerbose(attName + ":" + session.getAttribute(attName), module);
}
Debug.logVerbose("--- End Session Attributes ---", module);
Enumeration appNames = servletContext.getAttributeNames();
Enumeration<String> appNames = UtilGenerics.cast(servletContext.getAttributeNames());
Debug.logVerbose("--- Start ServletContext Attributes: ---", module);
while (appNames != null && appNames.hasMoreElements()) {
String attName = (String) appNames.nextElement();
String attName = appNames.nextElement();
Debug.logVerbose(attName + ":" + servletContext.getAttribute(attName), module);
}
Debug.logVerbose("--- End ServletContext Attributes ---", module);
@@ -35,7 +35,6 @@ import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.service.ServiceUtil;
/**
* Common Workers
@@ -41,7 +41,6 @@ import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilObject;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
@@ -35,7 +35,6 @@ import javolution.util.FastMap;
import net.sf.json.JSONObject;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
@@ -29,7 +29,6 @@ import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.webapp.control.ConfigXMLReader.Event;
import org.ofbiz.webapp.control.ConfigXMLReader.RequestMap;
@@ -78,7 +78,7 @@ public class JavaEventHandler implements EventHandler {
return invoke(event.path, event.invoke, eventClass, paramTypes, params);
}
private String invoke(String eventPath, String eventMethod, Class<?> eventClass, Class[] paramTypes, Object[] params) throws EventHandlerException {
private String invoke(String eventPath, String eventMethod, Class<?> eventClass, Class<?>[] paramTypes, Object[] params) throws EventHandlerException {
if (eventClass == null) {
throw new EventHandlerException("Error invoking event, the class " + eventPath + " was not found");
}
@@ -32,7 +32,6 @@ import javax.servlet.http.HttpServletResponse;
import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilObject;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
import org.ofbiz.service.GenericDispatcher;
@@ -38,9 +38,11 @@ import javolution.util.FastMap;
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.UtilFormatOut;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.minilang.SimpleMethod;
import org.ofbiz.minilang.method.MethodContext;
import org.ofbiz.webapp.control.ConfigXMLReader.Event;
@@ -86,7 +88,6 @@ public class WfsEventHandler implements EventHandler {
Element queryElem = null;
try {
Map paramMap = request.getParameterMap();
typeName = (String)request.getParameter("typename");
//determine if "get" or "post" and get "filter" param accordingly
if (UtilValidate.isNotEmpty(typeName)) {
@@ -110,7 +111,7 @@ public class WfsEventHandler implements EventHandler {
SimpleMethod meth = new SimpleMethod(simpleElem, null, null);
MethodContext methodContext = new MethodContext(request, response, null);
String retStr = meth.exec(methodContext); //Need to check return string
List entityList = (List) request.getAttribute("entityList");
List<GenericValue> entityList = UtilGenerics.cast(request.getAttribute("entityList"));
request.setAttribute("entityList", entityList);
} catch (TemplateException ioe) {
@@ -48,7 +48,6 @@ import org.apache.xmlrpc.server.XmlRpcHttpServerConfig;
import org.apache.xmlrpc.server.XmlRpcNoSuchHandlerException;
import org.apache.xmlrpc.util.HttpUtil;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilObject;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
@@ -45,6 +45,7 @@ public class OfbizAmountTransform implements TemplateTransformModel {
public static final String module = OfbizAmountTransform.class.getName();
public static final String SPELLED_OUT_FORMAT = "spelled-out";
@SuppressWarnings("unchecked")
private static String getArg(Map args, String key) {
String result = "";
Object o = args.get(key);
@@ -63,7 +64,7 @@ public class OfbizAmountTransform implements TemplateTransformModel {
}
return result;
}
@SuppressWarnings("unchecked")
private static Double getAmount(Map args, String key) {
if (args.containsKey(key)) {
Object o = args.get(key);
@@ -90,7 +91,7 @@ public class OfbizAmountTransform implements TemplateTransformModel {
}
return Double.valueOf(0.00);
}
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
final StringBuilder buf = new StringBuilder();
@@ -38,6 +38,7 @@ public class OfbizContentTransform implements TemplateTransformModel {
public final static String module = OfbizUrlTransform.class.getName();
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
final StringBuilder buf = new StringBuilder();
return new Writer(out) {
@@ -45,6 +45,7 @@ public class OfbizCurrencyTransform implements TemplateTransformModel {
public static final String module = OfbizCurrencyTransform.class.getName();
@SuppressWarnings("unchecked")
private static String getArg(Map args, String key) {
String result = "";
Object o = args.get(key);
@@ -64,6 +65,7 @@ public class OfbizCurrencyTransform implements TemplateTransformModel {
return result;
}
@SuppressWarnings("unchecked")
private static BigDecimal getAmount(Map args, String key) {
if (args.containsKey(key)) {
Object o = args.get(key);
@@ -83,6 +85,7 @@ public class OfbizCurrencyTransform implements TemplateTransformModel {
return BigDecimal.ZERO;
}
@SuppressWarnings("unchecked")
private static Integer getInteger(Map args, String key) {
if (args.containsKey(key)) {
Object o = args.get(key);
@@ -110,6 +113,7 @@ public class OfbizCurrencyTransform implements TemplateTransformModel {
return null;
}
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
final StringBuilder buf = new StringBuilder();
@@ -26,10 +26,7 @@ import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.webapp.control.RequestHandler;
import org.owasp.esapi.errors.EncodingException;
import freemarker.core.Environment;
import freemarker.ext.beans.BeanModel;
@@ -45,6 +42,7 @@ public class OfbizUrlTransform implements TemplateTransformModel {
public final static String module = OfbizUrlTransform.class.getName();
@SuppressWarnings("unchecked")
public boolean checkArg(Map args, String key, boolean defaultValue) {
if (!args.containsKey(key)) {
return defaultValue;
@@ -58,6 +56,7 @@ public class OfbizUrlTransform implements TemplateTransformModel {
}
}
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
final StringBuilder buf = new StringBuilder();
final boolean fullPath = checkArg(args, "fullPath", false);
@@ -37,6 +37,7 @@ public class RenderWrappedTextTransform implements TemplateTransformModel {
public static final String module = RenderWrappedTextTransform.class.getName();
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
final Environment env = Environment.getCurrentEnvironment();
Map<String, Object> ctx = checkMap(FreeMarkerWorker.getWrappedObject("context", env), String.class, Object.class);
@@ -39,6 +39,7 @@ public class SetRequestAttributeMethod implements TemplateMethodModelEx {
/*
* @see freemarker.template.TemplateMethodModel#exec(java.util.List)
*/
@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException {
if (args == null || args.size() != 2)
throw new TemplateModelException("Invalid number of arguements");
@@ -27,6 +27,7 @@ import java.util.Map;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.model.ModelEntity;
@@ -122,7 +123,7 @@ public class EntityField {
fieldObjectType = "comment"; // Default for NULL objects.
}
} else if (attrObject instanceof Map) {
Map valueMap = (Map) attrObject;
Map<String, ?> valueMap = UtilGenerics.cast(attrObject);
fieldObject = valueMap.get(field);
fieldObjectType = "comment"; // Default for NULL objects.
@@ -23,6 +23,7 @@ import java.util.Map;
import javax.servlet.jsp.PageContext;
import org.ofbiz.base.util.UtilFormatOut;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.entity.GenericValue;
/**
@@ -116,7 +117,7 @@ public class InputValue {
if (fieldVal != null)
inputValue = fieldVal.toString();
} else if (entTemp instanceof Map) {
Map map = (Map) entTemp;
Map<String, ?> map = UtilGenerics.cast(entTemp);
Object fieldVal = map.get(field);
if (fieldVal != null)
@@ -19,11 +19,11 @@
package org.ofbiz.webapp.stats;
import java.net.InetAddress;
import com.ibm.icu.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javolution.util.FastList;
@@ -32,7 +32,6 @@ import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilObject;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
@@ -40,6 +39,8 @@ import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.model.ModelEntity;
import com.ibm.icu.util.Calendar;
/**
* <p>Counts server hits and tracks statistics for request, events and views
* <p>Handles total stats since the server started and binned
@@ -97,16 +98,12 @@ public class ServerHitBin {
advanceAllBins(toTime, serviceHistory);
}
static void advanceAllBins(long toTime, Map binMap) {
Iterator entries = binMap.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry entry = (Map.Entry) entries.next();
static void advanceAllBins(long toTime, Map<String, List<ServerHitBin>> binMap) {
for (Map.Entry<String, List<ServerHitBin>> entry :binMap.entrySet()) {
if (entry.getValue() != null) {
ServerHitBin bin = (ServerHitBin) entry.getValue();
bin.advanceBin(toTime);
for (ServerHitBin bin: entry.getValue()) {
bin.advanceBin(toTime);
}
}
}
}
@@ -28,9 +28,6 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilObject;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
@@ -97,7 +97,7 @@ public class IfTag extends BodyTagSupport {
try {
if (object instanceof Collection) {
// the object is a Collection so compare the size.
if (((Collection) object).size() > localSize)
if (((Collection<?>) object).size() > localSize)
return EVAL_BODY_AGAIN;
} else if (object instanceof String) {
// the object is a Collection so compare the size.
@@ -26,6 +26,8 @@ import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;
import org.ofbiz.base.util.UtilGenerics;
/**
* IterateNextTag - JSP Tag to get the next element of the IteratorTag.
*/
@@ -85,15 +87,15 @@ public class IterateNextTag extends BodyTagSupport {
// expand a map element here if requested
if (expandMap) {
Map tempMap = (Map) element;
Iterator mapEntries = tempMap.entrySet().iterator();
Map<String, ?> tempMap = UtilGenerics.cast(element);
Iterator<Map.Entry<String, ?>> mapEntries = UtilGenerics.cast(tempMap.entrySet().iterator());
while (mapEntries.hasNext()) {
Map.Entry entry = (Map.Entry) mapEntries.next();
Map.Entry<String, ?> entry = mapEntries.next();
Object value = entry.getValue();
if (value == null) value = "";
pageContext.setAttribute((String) entry.getKey(), value);
pageContext.setAttribute(entry.getKey(), value);
}
}
@@ -39,7 +39,7 @@ public class IteratorHasNextTag extends BodyTagSupport {
if (iteratorTag == null)
throw new JspTagException("IterateNextTag not inside IteratorTag.");
Iterator iterator = iteratorTag.getIterator();
Iterator<?> iterator = iteratorTag.getIterator();
if (iterator == null || !iterator.hasNext())
return SKIP_BODY;
@@ -33,6 +33,7 @@ import javax.servlet.jsp.tagext.BodyTagSupport;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.ObjectType;
import org.ofbiz.base.util.UtilGenerics;
/**
@@ -46,7 +47,7 @@ public class IteratorTag extends BodyTagSupport {
protected String name = null;
protected String property = null;
protected Object element = null;
protected Class type = null;
protected Class<?> type = null;
protected int limit = 0;
protected int offset = 0;
protected boolean expandMap = false;
@@ -156,18 +157,18 @@ public class IteratorTag extends BodyTagSupport {
private boolean defineIterator() {
// clear the iterator, after this it may be set directly
Iterator<? extends Object> newIterator = null;
Collection<? extends Object> thisCollection = null;
Iterator<?> newIterator = null;
Collection<?> thisCollection = null;
if (property != null) {
if (Debug.verboseOn()) Debug.logVerbose("Getting iterator from property: " + property, module);
Object propertyObject = pageContext.findAttribute(property);
if (propertyObject instanceof Iterator) {
newIterator = (Iterator<? extends Object>) propertyObject;
newIterator = UtilGenerics.cast(propertyObject);
} else {
// if ClassCastException, it should indicate looking for a Collection
thisCollection = (Collection<? extends Object>) propertyObject;
thisCollection = UtilGenerics.cast(propertyObject);
}
} else {
// Debug.logInfo("No property, check for Object Tag.", module);
@@ -177,7 +178,7 @@ public class IteratorTag extends BodyTagSupport {
if (objectTag == null)
return false;
if (objectTag.getType().equals("java.util.Collection")) {
thisCollection = (Collection<? extends Object>) objectTag.getObject();
thisCollection = UtilGenerics.cast(objectTag.getObject());
} else {
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -186,8 +187,8 @@ public class IteratorTag extends BodyTagSupport {
for (int i = 0; i < m.length; i++) {
if (m[i].getName().equals("iterator")) {
Debug.logVerbose("Found iterator method. Using it.", module);
newIterator = (Iterator<? extends Object>) m[i].invoke(
objectTag.getObject(), (Object[]) null);
newIterator = UtilGenerics.cast( m[i].invoke(
objectTag.getObject(), (Object[]) null));
break;
}
}
@@ -239,15 +240,15 @@ public class IteratorTag extends BodyTagSupport {
// expand a map element here if requested
if (expandMap) {
Map tempMap = (Map) element;
Iterator mapEntries = tempMap.entrySet().iterator();
Map<String, ?> tempMap = UtilGenerics.cast(element);
Iterator<Map.Entry<String, ?>> mapEntries = UtilGenerics.cast(tempMap.entrySet().iterator());
while (mapEntries.hasNext()) {
Map.Entry entry = (Map.Entry) mapEntries.next();
Map.Entry<String, ?> entry = mapEntries.next();
Object value = entry.getValue();
if (value == null) value = "";
pageContext.setAttribute((String) entry.getKey(), value);
pageContext.setAttribute(entry.getKey(), value);
}
}
@@ -22,6 +22,8 @@ import java.util.Map;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
import org.ofbiz.base.util.UtilGenerics;
/**
* ParamTag - Defines a parameter for the service tag.
*/
@@ -105,7 +107,7 @@ public class ParamTag extends TagSupport {
value = pageContext.getRequest().getParameter(attribute);
} else {
try {
Map mapObject = (Map) pageContext.findAttribute(map);
Map<String, Object> mapObject = UtilGenerics.cast(pageContext.findAttribute(map));
value = mapObject.get(attribute);
} catch (Exception e) {
@@ -18,8 +18,8 @@
*******************************************************************************/
package org.ofbiz.webapp.taglib;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.PageContext;
@@ -51,9 +51,6 @@ public class AbstractXmlRpcTestCase extends TestCase {
this.keyAlias = null;
}
private AbstractXmlRpcTestCase() {
//super();
}
public org.apache.xmlrpc.client.XmlRpcClient getRpcClient(String url) throws MalformedURLException {
return getRpcClient(url, null, null);
@@ -20,6 +20,7 @@
package org.ofbiz.webapp.test;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.ofbiz.base.util.UtilGenerics;
import java.util.Map;
@@ -38,7 +39,7 @@ public class XmlRpcTests extends AbstractXmlRpcTestCase {
public void testXmlRpcRequest() throws Exception {
XmlRpcClient client = this.getRpcClient(url, "admin", "ofbiz");
Object[] params = new Object[] { 55.00, "message from xml-rpc client" };
Map result = (Map) client.execute("testScv", params);
Map<String, Object> result = UtilGenerics.cast(client.execute("testScv", params));
assertEquals("XML-RPC Service result success", "service done", result.get("resp"));
}
}
@@ -21,16 +21,13 @@ package org.ofbiz.webapp.view;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilProperties;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
@@ -39,6 +36,8 @@ import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.io.VelocityWriter;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.util.SimplePool;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilProperties;
/**
* VelocityViewHandler - Velocity Template Engine View Handler
@@ -26,8 +26,8 @@ import java.io.StringWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Map;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
@@ -37,10 +37,8 @@ import javolution.util.FastMap;
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.HttpClient;
import org.ofbiz.base.util.HttpClientException;
import org.ofbiz.webapp.view.ViewHandler;
import org.ofbiz.webapp.view.ViewHandlerException;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.entity.GenericValue;
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.Configuration;
@@ -75,7 +73,7 @@ public class WfsViewHandler extends AbstractViewHandler {
try {
String result = null;
List entityList = (List)request.getAttribute("entityList");
List<GenericValue> entityList = UtilGenerics.cast(request.getAttribute("entityList"));
SimpleSequence simpleList = new SimpleSequence(entityList);
Map<String, Object> ctx = FastMap.newInstance();
ctx.put("entityList", simpleList);
@@ -32,7 +32,6 @@ import javax.servlet.http.HttpSession;
import org.ofbiz.base.util.CachedClassLoader;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilObject;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
import org.ofbiz.security.Security;