- * The class will attempt to use java.util.List.subList(int,int) to index into the list for the
- * appropriate page.
+ * The class will attempt to use java.util.List.subList(int,int) to index into the list for the appropriate
+ * page.
*
*
* If the list does not contain enough elements to support the sub list, then the first pageSize elements
@@ -44,17 +44,17 @@ public PaginationHelper(int pageNumber, int pageSize)
this.pageSize = pageSize;
}
- public Iterator getIterator(Object data)
+ public Iterator getIterator(Object data)
{
if (data instanceof List)
{
- return getIterator((List) data);
+ return getIterator((List) data);
}
return IteratorUtils.getIterator(data);
}
- public Iterator getIterator(List data)
+ public Iterator getIterator(List data)
{
int start = getStart(data.size());
int end = getEnd(data.size(), start);
diff --git a/displaytag/src/main/java/org/displaytag/pagination/SmartListHelper.java b/displaytag/src/main/java/org/displaytag/pagination/SmartListHelper.java
index 50951a7b8..d6beb3862 100644
--- a/displaytag/src/main/java/org/displaytag/pagination/SmartListHelper.java
+++ b/displaytag/src/main/java/org/displaytag/pagination/SmartListHelper.java
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.displaytag.Messages;
+import org.displaytag.model.Row;
import org.displaytag.properties.TableProperties;
import org.displaytag.util.Href;
@@ -363,8 +364,11 @@ else if (pagination.isLast())
bannerFormat = this.properties.getPagingBannerFull();
}
- return pagination.getFormattedBanner(this.properties.getPagingPageLink(), this.properties
- .getPagingPageSelected(), this.properties.getPagingPageSeparator(), bannerFormat);
+ return pagination.getFormattedBanner(
+ this.properties.getPagingPageLink(),
+ this.properties.getPagingPageSelected(),
+ this.properties.getPagingPageSeparator(),
+ bannerFormat);
}
/**
diff --git a/displaytag/src/main/java/org/displaytag/portlet/PortletHref.java b/displaytag/src/main/java/org/displaytag/portlet/PortletHref.java
index 7f3032088..c65c5652e 100644
--- a/displaytag/src/main/java/org/displaytag/portlet/PortletHref.java
+++ b/displaytag/src/main/java/org/displaytag/portlet/PortletHref.java
@@ -543,21 +543,15 @@ public String toString()
}
}
- for (final Iterator paramItr = this.parameters.entrySet().iterator(); paramItr.hasNext();)
+ for (final Iterator> paramItr = this.parameters.entrySet().iterator(); paramItr
+ .hasNext();)
{
- final Map.Entry entry = (Map.Entry) paramItr.next();
+ final Entry entry = paramItr.next();
- final String name = (String) entry.getKey();
- final Object value = entry.getValue();
+ final String name = entry.getKey();
+ final String[] value = entry.getValue();
- if (value instanceof String)
- {
- url.setParameter(name, (String) value);
- }
- else if (value instanceof String[])
- {
- url.setParameter(name, (String[]) value);
- }
+ url.setParameter(name, value);
}
if (this.getAnchor() == null)
diff --git a/displaytag/src/main/java/org/displaytag/portlet/PortletRequestHelper.java b/displaytag/src/main/java/org/displaytag/portlet/PortletRequestHelper.java
index 90213bf40..5ee6861e6 100644
--- a/displaytag/src/main/java/org/displaytag/portlet/PortletRequestHelper.java
+++ b/displaytag/src/main/java/org/displaytag/portlet/PortletRequestHelper.java
@@ -118,7 +118,7 @@ public Integer getIntParameter(String key)
* @see org.displaytag.util.RequestHelper#getParameterMap()
*/
@Override
- public Map getParameterMap()
+ public Map getParameterMap()
{
return this.portletRequest.getParameterMap();
}
diff --git a/displaytag/src/main/java/org/displaytag/tags/TableTag.java b/displaytag/src/main/java/org/displaytag/tags/TableTag.java
index 959b3ccbc..1d2ee0b21 100644
--- a/displaytag/src/main/java/org/displaytag/tags/TableTag.java
+++ b/displaytag/src/main/java/org/displaytag/tags/TableTag.java
@@ -270,7 +270,7 @@ public class TableTag extends HtmlTableTag
/**
* Iterator on collection.
*/
- private Iterator tableIterator;
+ private Iterator< ? > tableIterator;
/**
* export type - set in initParameters().
@@ -1130,7 +1130,7 @@ else if (!(size instanceof Integer))
*/
protected boolean isIncludedRow()
{
- return ((Range) filteredRows).contains(this.rowNumber);
+ return filteredRows.contains(this.rowNumber);
}
/**
@@ -1391,7 +1391,7 @@ private void describeEmptyTable()
if (this.tableIterator.hasNext())
{
Object iteratedObject = this.tableIterator.next();
- Map objectProperties = new HashMap();
+ Map objectProperties = new HashMap();
// if it's a String don't add the "Bytes" column
if (iteratedObject instanceof String)
@@ -1401,7 +1401,7 @@ private void describeEmptyTable()
// if it's a map already use key names for column headers
if (iteratedObject instanceof Map)
{
- objectProperties = (Map) iteratedObject;
+ objectProperties = (Map) iteratedObject;
}
else
{
@@ -1494,7 +1494,7 @@ protected void writeExport(ExportView exportView) throws IOException, JspExcepti
HttpServletResponse response = (HttpServletResponse) this.pageContext.getResponse();
HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
- Map bean = (Map) request.getAttribute(FILTER_CONTENT_OVERRIDE_BODY);
+ Map bean = (Map) request.getAttribute(FILTER_CONTENT_OVERRIDE_BODY);
boolean usingFilter = bean != null;
String mimeType = exportView.getMimeType();
diff --git a/displaytag/src/main/java/org/displaytag/util/DefaultHref.java b/displaytag/src/main/java/org/displaytag/util/DefaultHref.java
index 1987b551f..887bc2819 100644
--- a/displaytag/src/main/java/org/displaytag/util/DefaultHref.java
+++ b/displaytag/src/main/java/org/displaytag/util/DefaultHref.java
@@ -313,13 +313,13 @@ public String toString()
if (this.parameters.size() > 0)
{
buffer.append('?');
- Set parameterSet = this.parameters.entrySet();
+ Set> parameterSet = this.parameters.entrySet();
- Iterator iterator = parameterSet.iterator();
+ Iterator> iterator = parameterSet.iterator();
while (iterator.hasNext())
{
- Map.Entry entry = (Map.Entry) iterator.next();
+ Entry entry = iterator.next();
Object key = entry.getKey();
Object value = entry.getValue();
diff --git a/displaytag/src/main/java/org/displaytag/util/HtmlAttributeMap.java b/displaytag/src/main/java/org/displaytag/util/HtmlAttributeMap.java
index 369e4d713..67add6645 100644
--- a/displaytag/src/main/java/org/displaytag/util/HtmlAttributeMap.java
+++ b/displaytag/src/main/java/org/displaytag/util/HtmlAttributeMap.java
@@ -22,7 +22,7 @@
* @author Fabrizio Giustina
* @version $Revision$ ($Author$)
*/
-public class HtmlAttributeMap extends HashMap
+public class HtmlAttributeMap extends HashMap
{
/**
@@ -62,14 +62,14 @@ public String toString()
StringBuffer buffer = new StringBuffer(size() * 30);
// get the entrySet
- Set entrySet = entrySet();
+ Set> entrySet = entrySet();
- Iterator> iterator = entrySet.iterator();
+ Iterator> iterator = entrySet.iterator();
// iterates on attributes
while (iterator.hasNext())
{
- Map.Entry entry = iterator.next();
+ Map.Entry entry = iterator.next();
// append a new atribute
buffer
diff --git a/displaytag/src/main/java/org/displaytag/util/LookupUtil.java b/displaytag/src/main/java/org/displaytag/util/LookupUtil.java
index 539e0e782..298f1e702 100644
--- a/displaytag/src/main/java/org/displaytag/util/LookupUtil.java
+++ b/displaytag/src/main/java/org/displaytag/util/LookupUtil.java
@@ -221,7 +221,7 @@ public static Object getProperty(Object bean, String name) throws IllegalAccessE
indexOfMAPPEDDELIM = next.indexOf(MAPPED_DELIM);
if (evalBean instanceof Map)
{
- evalBean = ((Map) evalBean).get(next);
+ evalBean = ((Map< ? , ? >) evalBean).get(next);
}
else if (indexOfMAPPEDDELIM >= 0)
{
@@ -252,7 +252,7 @@ else if (indexOfINDEXEDDELIM >= 0)
if (evalBean instanceof Map)
{
- evalBean = ((Map) evalBean).get(evalName);
+ evalBean = ((Map< ? , ? >) evalBean).get(evalName);
}
else if (indexOfMAPPEDDELIM >= 0)
{
@@ -322,7 +322,7 @@ public static Object getIndexedProperty(Object bean, String name) throws Illegal
{
if (bean instanceof List)
{
- return ((List) bean).get(index);
+ return ((List< ? >) bean).get(index);
}
else if (bean.getClass().isArray())
{
diff --git a/displaytag/src/main/java/org/displaytag/util/PostHref.java b/displaytag/src/main/java/org/displaytag/util/PostHref.java
index ad6f66773..6b7699f07 100644
--- a/displaytag/src/main/java/org/displaytag/util/PostHref.java
+++ b/displaytag/src/main/java/org/displaytag/util/PostHref.java
@@ -4,6 +4,7 @@
import java.net.URLDecoder;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
@@ -164,14 +165,14 @@ public String toString()
Map parameters = getParameterMap();
- Set parameterSet = parameters.entrySet();
+ Set> parameterSet = parameters.entrySet();
- Iterator> iterator = parameterSet.iterator();
+ Iterator> iterator = parameterSet.iterator();
while (iterator.hasNext())
{
// {f:'param1',v:'1'},
- Map.Entry entry = iterator.next();
+ Entry entry = iterator.next();
Object key = entry.getKey();
Object value = entry.getValue();
diff --git a/displaytag/src/test/java/org/displaytag/pagination/PaginationHelperTest.java b/displaytag/src/test/java/org/displaytag/pagination/PaginationHelperTest.java
index caa7343b2..5d15fe17d 100644
--- a/displaytag/src/test/java/org/displaytag/pagination/PaginationHelperTest.java
+++ b/displaytag/src/test/java/org/displaytag/pagination/PaginationHelperTest.java
@@ -29,7 +29,7 @@
* @author Kevin Conaway
* @version $Revision$ ($Author$)
*/
-public class PaginationHelperTest
+public class PaginationHelperTest
{
@Test
@@ -115,13 +115,13 @@ public void testGetSublistForEntirePage()
/**
* Ensures that the data passed to the helper is cast as an object
*/
- protected Iterator getIterator(Object data, int pageNumber, int pageSize)
+ protected Iterator getIterator(Object data, int pageNumber, int pageSize)
{
PaginationHelper helper = new PaginationHelper(pageNumber, pageSize);
return helper.getIterator(data);
}
- protected void print(Iterator iterator, String message)
+ protected void print(Iterator< ? extends Object> iterator, String message)
{
while (iterator.hasNext())
{
@@ -137,7 +137,7 @@ protected void add(Collection collection, int number)
}
}
- protected void assertEquals(Iterator expected, Iterator actual)
+ protected void assertEquals(Iterator< ? extends Object> expected, Iterator< ? extends Object> actual)
{
while (expected.hasNext())
{
diff --git a/displaytag/src/test/java/org/displaytag/portlet/PortletHrefTest.java b/displaytag/src/test/java/org/displaytag/portlet/PortletHrefTest.java
index fe3da7ac1..7128c6f7d 100644
--- a/displaytag/src/test/java/org/displaytag/portlet/PortletHrefTest.java
+++ b/displaytag/src/test/java/org/displaytag/portlet/PortletHrefTest.java
@@ -320,7 +320,7 @@ public void testRemoveParameter()
href.removeParameter("SINGLE_PARAM");
- final Map actualParams2 = href.getParameterMap();
+ final Map actualParams2 = href.getParameterMap();
Assert.assertEquals(0, actualParams2.size());
Assert.assertNull(actualParams2.get("SINGLE_PARAM"));
}
@@ -447,7 +447,7 @@ public void testFullUrl()
"https://localhost/mockportlet?urlType=action;windowState=maximized;portletMode=edit;param_SINGLE_PARAM=VAL",
urlString10);
- final Map paramMap = new HashMap();
+ final Map paramMap = new HashMap();
paramMap.put("MULTI_PARAM", new String[]{"VAL1", "VAL2"});
href.addParameterMap(paramMap);
final String urlString11 = href.toString();
diff --git a/displaytag/src/test/java/org/displaytag/portlet/PortletRequestHelperTest.java b/displaytag/src/test/java/org/displaytag/portlet/PortletRequestHelperTest.java
index c305abbb9..f1565dddc 100644
--- a/displaytag/src/test/java/org/displaytag/portlet/PortletRequestHelperTest.java
+++ b/displaytag/src/test/java/org/displaytag/portlet/PortletRequestHelperTest.java
@@ -115,16 +115,16 @@ public void testRequestParameters()
final Integer nullIntVal = helper.getIntParameter("STRING_PARAM");
Assert.assertNull(nullIntVal);
- final Map params = helper.getParameterMap();
+ final Map params = helper.getParameterMap();
Assert.assertEquals(2, params.size());
final String[] expextedStrArryVal = new String[]{"STRING_VALUE"};
- final String[] strArryVal = (String[]) params.get("STRING_PARAM");
+ final String[] strArryVal = params.get("STRING_PARAM");
Assert.assertEquals(expextedStrArryVal.length, strArryVal.length);
Assert.assertEquals(expextedStrArryVal[0], strArryVal[0]);
final String[] expextedIntArryVal = new String[]{"31337"};
- final String[] intArryVal = (String[]) params.get("INTEGER_PARAM");
+ final String[] intArryVal = params.get("INTEGER_PARAM");
Assert.assertEquals(expextedIntArryVal.length, intArryVal.length);
Assert.assertEquals(expextedIntArryVal[0], intArryVal[0]);
}
@@ -141,7 +141,7 @@ public void testCreateEmptyHref()
final PortletHref ref = (PortletHref) helper.getHref();
- final Map params = ref.getParameterMap();
+ final Map params = ref.getParameterMap();
Assert.assertEquals(0, params.size());
Assert.assertNull(ref.getAnchor());
@@ -166,7 +166,7 @@ public void testCreateSecureHref()
final PortletHref ref = (PortletHref) helper.getHref();
- final Map params = ref.getParameterMap();
+ final Map params = ref.getParameterMap();
Assert.assertEquals(0, params.size());
Assert.assertNull(ref.getAnchor());
@@ -192,16 +192,16 @@ public void testParameterizedHref()
final PortletHref ref = (PortletHref) helper.getHref();
- final Map params = ref.getParameterMap();
+ final Map params = ref.getParameterMap();
Assert.assertEquals(2, params.size());
final String[] expextedStrArryVal = new String[]{"STRING_VALUE"};
- final String[] strArryVal = (String[]) params.get("STRING_PARAM");
+ final String[] strArryVal = params.get("STRING_PARAM");
Assert.assertEquals(expextedStrArryVal.length, strArryVal.length);
Assert.assertEquals(expextedStrArryVal[0], strArryVal[0]);
final String[] expextedIntArryVal = new String[]{"31337"};
- final String[] intArryVal = (String[]) params.get("INTEGER_PARAM");
+ final String[] intArryVal = params.get("INTEGER_PARAM");
Assert.assertEquals(expextedIntArryVal.length, intArryVal.length);
Assert.assertEquals(expextedIntArryVal[0], intArryVal[0]);
diff --git a/displaytag/src/test/java/org/displaytag/test/NumberComparator.java b/displaytag/src/test/java/org/displaytag/test/NumberComparator.java
index 56ad6c338..9050ca38a 100644
--- a/displaytag/src/test/java/org/displaytag/test/NumberComparator.java
+++ b/displaytag/src/test/java/org/displaytag/test/NumberComparator.java
@@ -11,7 +11,7 @@
* @author Fabrizio Giustina
* @version $Revision$ ($Author$)
*/
-public class NumberComparator implements Comparator
+public class NumberComparator implements Comparator
{
/**
diff --git a/displaytag/src/test/java/org/displaytag/tld/TldTest.java b/displaytag/src/test/java/org/displaytag/tld/TldTest.java
index 4ca29a199..f508e5495 100644
--- a/displaytag/src/test/java/org/displaytag/tld/TldTest.java
+++ b/displaytag/src/test/java/org/displaytag/tld/TldTest.java
@@ -77,10 +77,10 @@ public void checkTld(String checkedTld) throws Exception
log.debug("testing " + attribute);
}
String className = attribute.getTagClass();
- Class tagClass = null;
+ Class tagClass = null;
try
{
- tagClass = Class.forName(className);
+ tagClass = (Class) Class.forName(className);
}
catch (ClassNotFoundException e)
{
@@ -112,12 +112,12 @@ public void checkTld(String checkedTld) throws Exception
continue;
}
- Class propertyType = PropertyUtils.getPropertyType(tagObject, attribute.getAttributeName());
+ Class< ? > propertyType = PropertyUtils.getPropertyType(tagObject, attribute.getAttributeName());
String tldType = attribute.getAttributeType();
if (tldType != null)
{
- Class tldTypeClass = getClassFromName(tldType);
+ Class< ? > tldTypeClass = getClassFromName(tldType);
if (!propertyType.isAssignableFrom(tldTypeClass))
{
@@ -150,10 +150,10 @@ public void checkTld(String checkedTld) throws Exception
* @param className clss name
* @return Class istantiated using Class.forName or the matching primitive.
*/
- private Class getClassFromName(String className)
+ private Class< ? > getClassFromName(String className)
{
- Class tldTypeClass = null;
+ Class< ? > tldTypeClass = null;
if ("int".equals(className))
{
diff --git a/displaytag/src/test/resources/jsps/DISPL-049.jsp b/displaytag/src/test/resources/jsps/DISPL-049.jsp
index e941a56bb..b526b2ff9 100644
--- a/displaytag/src/test/resources/jsps/DISPL-049.jsp
+++ b/displaytag/src/test/resources/jsps/DISPL-049.jsp
@@ -13,10 +13,11 @@
request.setAttribute( "test", testData);
]]>
-
+ pageContext.setAttribute("counter", new Integer(0));
-
-
+ pageContext.setAttribute("counter", ((Integer)pageContext.getAttribute("counter")) + 1);
+
+