Author: jleroux
Date: Sat Nov 14 08:29:42 2009 New Revision: 836141 URL: http://svn.apache.org/viewvc?rev=836141&view=rev Log: 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 Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JSONServiceMultiEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JavaEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/WfsEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizAmountTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/RenderWrappedTextTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetRequestAttributeMethod.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/EntityField.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IfTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IterateNextTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorHasNextTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ParamTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ServiceTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/AbstractXmlRpcTestCase.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/WfsViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Sat Nov 14 08:29:42 2009 @@ -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.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 @@ } 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 @@ 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"); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java Sat Nov 14 08:29:42 2009 @@ -28,6 +28,7 @@ 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 @@ 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 @@ } 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)) { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Sat Nov 14 08:29:42 2009 @@ -32,6 +32,7 @@ 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 @@ 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); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java Sat Nov 14 08:29:42 2009 @@ -35,7 +35,6 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.service.ServiceUtil; /** * Common Workers Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java Sat Nov 14 08:29:42 2009 @@ -41,7 +41,6 @@ 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; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java Sat Nov 14 08:29:42 2009 @@ -35,7 +35,6 @@ 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; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JSONServiceMultiEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JSONServiceMultiEventHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JSONServiceMultiEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JSONServiceMultiEventHandler.java Sat Nov 14 08:29:42 2009 @@ -29,7 +29,6 @@ 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; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JavaEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JavaEventHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JavaEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JavaEventHandler.java Sat Nov 14 08:29:42 2009 @@ -78,7 +78,7 @@ 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"); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java Sat Nov 14 08:29:42 2009 @@ -32,7 +32,6 @@ 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; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/WfsEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/WfsEventHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/WfsEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/WfsEventHandler.java Sat Nov 14 08:29:42 2009 @@ -38,9 +38,11 @@ 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 @@ 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 @@ 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) { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java Sat Nov 14 08:29:42 2009 @@ -48,7 +48,6 @@ 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; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizAmountTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizAmountTransform.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizAmountTransform.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizAmountTransform.java Sat Nov 14 08:29:42 2009 @@ -45,6 +45,7 @@ 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 @@ } 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 @@ } return Double.valueOf(0.00); } - + @SuppressWarnings("unchecked") public Writer getWriter(final Writer out, Map args) { final StringBuilder buf = new StringBuilder(); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java Sat Nov 14 08:29:42 2009 @@ -38,6 +38,7 @@ 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) { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java Sat Nov 14 08:29:42 2009 @@ -45,6 +45,7 @@ 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 @@ 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 @@ 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 @@ return null; } + @SuppressWarnings("unchecked") public Writer getWriter(final Writer out, Map args) { final StringBuilder buf = new StringBuilder(); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java Sat Nov 14 08:29:42 2009 @@ -26,10 +26,7 @@ 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 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 @@ } } + @SuppressWarnings("unchecked") public Writer getWriter(final Writer out, Map args) { final StringBuilder buf = new StringBuilder(); final boolean fullPath = checkArg(args, "fullPath", false); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/RenderWrappedTextTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/RenderWrappedTextTransform.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/RenderWrappedTextTransform.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/RenderWrappedTextTransform.java Sat Nov 14 08:29:42 2009 @@ -37,6 +37,7 @@ 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); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetRequestAttributeMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetRequestAttributeMethod.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetRequestAttributeMethod.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetRequestAttributeMethod.java Sat Nov 14 08:29:42 2009 @@ -39,6 +39,7 @@ /* * @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"); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/EntityField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/EntityField.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/EntityField.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/EntityField.java Sat Nov 14 08:29:42 2009 @@ -27,6 +27,7 @@ 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 @@ 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. Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java Sat Nov 14 08:29:42 2009 @@ -23,6 +23,7 @@ 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 @@ 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) Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java Sat Nov 14 08:29:42 2009 @@ -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 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.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 @@ 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); + } } } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java Sat Nov 14 08:29:42 2009 @@ -28,9 +28,6 @@ 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; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IfTag.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IfTag.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IfTag.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IfTag.java Sat Nov 14 08:29:42 2009 @@ -97,7 +97,7 @@ 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. Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IterateNextTag.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IterateNextTag.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IterateNextTag.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IterateNextTag.java Sat Nov 14 08:29:42 2009 @@ -26,6 +26,8 @@ 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 @@ // 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); } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorHasNextTag.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorHasNextTag.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorHasNextTag.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorHasNextTag.java Sat Nov 14 08:29:42 2009 @@ -39,7 +39,7 @@ 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; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorTag.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorTag.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorTag.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorTag.java Sat Nov 14 08:29:42 2009 @@ -33,6 +33,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.ObjectType; +import org.ofbiz.base.util.UtilGenerics; /** @@ -46,7 +47,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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); } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ParamTag.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ParamTag.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ParamTag.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ParamTag.java Sat Nov 14 08:29:42 2009 @@ -22,6 +22,8 @@ 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 @@ 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) { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ServiceTag.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ServiceTag.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ServiceTag.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ServiceTag.java Sat Nov 14 08:29:42 2009 @@ -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; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/AbstractXmlRpcTestCase.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/AbstractXmlRpcTestCase.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/AbstractXmlRpcTestCase.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/AbstractXmlRpcTestCase.java Sat Nov 14 08:29:42 2009 @@ -51,9 +51,6 @@ this.keyAlias = null; } - private AbstractXmlRpcTestCase() { - //super(); - } public org.apache.xmlrpc.client.XmlRpcClient getRpcClient(String url) throws MalformedURLException { return getRpcClient(url, null, null); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java Sat Nov 14 08:29:42 2009 @@ -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 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")); } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java Sat Nov 14 08:29:42 2009 @@ -21,16 +21,13 @@ 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.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 Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/WfsViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/WfsViewHandler.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/WfsViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/WfsViewHandler.java Sat Nov 14 08:29:42 2009 @@ -26,8 +26,8 @@ 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 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 @@ 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); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java?rev=836141&r1=836140&r2=836141&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java Sat Nov 14 08:29:42 2009 @@ -32,7 +32,6 @@ 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; |
Free forum by Nabble | Edit this page |