diff --git a/displaytag/src/main/java/org/displaytag/decorator/TotalTableDecorator.java b/displaytag/src/main/java/org/displaytag/decorator/TotalTableDecorator.java index 8915df759..3a9ed92c8 100644 --- a/displaytag/src/main/java/org/displaytag/decorator/TotalTableDecorator.java +++ b/displaytag/src/main/java/org/displaytag/decorator/TotalTableDecorator.java @@ -169,7 +169,7 @@ public final String finishRow() StringBuffer buffer = new StringBuffer(1000); // Grand totals... - if (getViewIndex() == ((List) getDecoratedObject()).size() - 1) + if (getViewIndex() == ((List) getDecoratedObject()).size() - 1) { if (groupPropertyName != null) { diff --git a/displaytag/src/main/java/org/displaytag/export/ExportViewFactory.java b/displaytag/src/main/java/org/displaytag/export/ExportViewFactory.java index 594d7d6ae..0927d8ca5 100644 --- a/displaytag/src/main/java/org/displaytag/export/ExportViewFactory.java +++ b/displaytag/src/main/java/org/displaytag/export/ExportViewFactory.java @@ -46,7 +46,7 @@ public final class ExportViewFactory /** * Map containing MediaTypeEnum - View class. */ - private final Map viewClasses = new HashMap(); + private final Map> viewClasses = new HashMap>(); /** * Private constructor. @@ -89,10 +89,10 @@ public static synchronized ExportViewFactory getInstance() */ public void registerExportView(String name, String viewClassName) { - Class exportClass; + Class exportClass; try { - exportClass = ReflectHelper.classForName(viewClassName); + exportClass = (Class) ReflectHelper.classForName(viewClassName); } catch (ClassNotFoundException e) { @@ -103,7 +103,8 @@ public void registerExportView(String name, String viewClassName) catch (NoClassDefFoundError e) { log.warn(Messages.getString("ExportViewFactory.noclassdef" //$NON-NLS-1$ - , new Object[]{name, viewClassName, e.getMessage()})); + , + new Object[]{name, viewClassName, e.getMessage()})); return; } @@ -126,7 +127,8 @@ public void registerExportView(String name, String viewClassName) catch (NoClassDefFoundError e) { log.warn(Messages.getString("ExportViewFactory.noclassdef" //$NON-NLS-1$ - , new Object[]{name, viewClassName, e.getMessage()})); + , + new Object[]{name, viewClassName, e.getMessage()})); return; } @@ -154,11 +156,11 @@ public ExportView getView(MediaTypeEnum exportType, TableModel tableModel, boole { ExportView view; - Class viewClass = viewClasses.get(exportType); + Class viewClass = viewClasses.get(exportType); try { - view = (ExportView) viewClass.newInstance(); + view = viewClass.newInstance(); } catch (InstantiationException e) { diff --git a/displaytag/src/main/java/org/displaytag/export/excel/ExcelHssfView.java b/displaytag/src/main/java/org/displaytag/export/excel/ExcelHssfView.java index c72c3e93c..fb1dcc2b5 100644 --- a/displaytag/src/main/java/org/displaytag/export/excel/ExcelHssfView.java +++ b/displaytag/src/main/java/org/displaytag/export/excel/ExcelHssfView.java @@ -80,7 +80,6 @@ public ExcelHssfView() { } - /** * @see org.displaytag.export.ExportView#setParameters(TableModel, boolean, boolean, boolean) */ @@ -126,13 +125,13 @@ public void doExport(OutputStream out) throws JspException // Create an header row HSSFRow xlsRow = sheet.createRow(rowNum++); - Iterator iterator = this.model.getHeaderCellList().iterator(); + Iterator iterator = this.model.getHeaderCellList().iterator(); while (iterator.hasNext()) { - HeaderCell headerCell = (HeaderCell) iterator.next(); + HeaderCell headerCell = iterator.next(); - HSSFCell cell = xlsRow.createCell( colNum++); + HSSFCell cell = xlsRow.createCell(colNum++); cell.setCellValue(new HSSFRichTextString(getHeaderCellValue(headerCell))); cell.setCellStyle(createHeaderStyle(getWb(), headerCell)); } @@ -176,16 +175,15 @@ public void doExport(OutputStream out) throws JspException } /** - * Uses POI Autosizing. - * - * WARNING. This has been known to cause performance problems and various exceptions. use at your own risk! Overriding this method is suggested. - * - * From POI HSSF documentation for autoSizeColumn: - * "To calculate column width HSSFSheet.autoSizeColumn uses Java2D classes that throw exception if graphical environment is not available. - * In case if graphical environment is not available, you must tell Java that you are running in headless mode and set the following system property: java.awt.headless=true." + * Uses POI Autosizing. WARNING. This has been known to cause performance problems and various exceptions. use at + * your own risk! Overriding this method is suggested. From POI HSSF documentation for autoSizeColumn: "To calculate + * column width HSSFSheet.autoSizeColumn uses Java2D classes that throw exception if graphical environment is not + * available. In case if graphical environment is not available, you must tell Java that you are running in headless + * mode and set the following system property: java.awt.headless=true." */ - protected void autosizeColumns() { - for (int i=0; i < getModel().getNumberOfColumns(); i++) + protected void autosizeColumns() + { + for (int i = 0; i < getModel().getNumberOfColumns(); i++) { getSheet().autoSizeColumn((short) i); // since this usually creates column widths that are just too short, adjust here! @@ -197,13 +195,14 @@ protected void autosizeColumns() { } /** - * Write the value to the cell. Override this method if you have complex data types that may need to be exported. + * Write the value to the cell. Override this method if you have complex data types that may need to be exported. * @param value the value of the cell * @param cell the cell to write it to */ protected void writeCell(Object value, HSSFCell cell) { - if (value == null) { + if (value == null) + { cell.setCellValue(new HSSFRichTextString("")); } else if (value instanceof Integer) @@ -242,7 +241,6 @@ else if (value instanceof Calendar) } } - /** * Templated method that is called for all non-header & non-total cells. * @param wb @@ -324,14 +322,16 @@ public String getSheetName() public void setSheetName(String sheetName) throws JspException { - // this is due to either the POI limitations or excel (I'm not sure). you get the following error if you don't do this: - // Exception: [.ExcelHssfView] !ExcelView.errorexporting! Cause: Sheet name cannot be blank, greater than 31 chars, or contain any of /\*?[] + // this is due to either the POI limitations or excel (I'm not sure). you get the following error if you don't + // do this: + // Exception: [.ExcelHssfView] !ExcelView.errorexporting! Cause: Sheet name cannot be blank, greater than 31 + // chars, or contain any of /\*?[] if (StringUtils.isBlank(sheetName)) { throw new JspException("The sheet name property " + ExcelUtils.EXCEL_SHEET_NAME + " must not be blank."); } - sheetName = sheetName.replaceAll("/|\\\\|\\*|\\?|\\[|\\]",""); - this.sheetName = sheetName.length() <= 31 ? sheetName : sheetName.substring(0,31-3) + "..."; + sheetName = sheetName.replaceAll("/|\\\\|\\*|\\?|\\[|\\]", ""); + this.sheetName = sheetName.length() <= 31 ? sheetName : sheetName.substring(0, 31 - 3) + "..."; } public HSSFCellStyle getNewCellStyle() diff --git a/displaytag/src/main/java/org/displaytag/export/excel/ExcelUtils.java b/displaytag/src/main/java/org/displaytag/export/excel/ExcelUtils.java index 9caaf4278..085b334c5 100644 --- a/displaytag/src/main/java/org/displaytag/export/excel/ExcelUtils.java +++ b/displaytag/src/main/java/org/displaytag/export/excel/ExcelUtils.java @@ -211,7 +211,7 @@ public static String escapeColumnValue(Object rawValue) return null; } // str = Patterns.replaceAll(str, "(\\r\\n|\\r|\\n|\\n\\r)\\s*", ""); - String returnString = rawValue != null ? rawValue.toString() : StringUtils.EMPTY; + String returnString = rawValue.toString(); // escape the String to get the tabs, returns, newline explicit as \t \r \n returnString = StringEscapeUtils.escapeJava(StringUtils.trimToEmpty(returnString)); // remove tabs, insert four whitespaces instead diff --git a/displaytag/src/main/java/org/displaytag/filter/ExportDelegate.java b/displaytag/src/main/java/org/displaytag/filter/ExportDelegate.java index a6330f232..4b47bdffc 100644 --- a/displaytag/src/main/java/org/displaytag/filter/ExportDelegate.java +++ b/displaytag/src/main/java/org/displaytag/filter/ExportDelegate.java @@ -71,7 +71,7 @@ protected static void writeExport(HttpServletResponse response, ServletRequest r // response (this is the signal from table tag that it is going to write exported data) log.debug("Filter operating in buffered mode. "); - Map bean = (Map) request.getAttribute(TableTag.FILTER_CONTENT_OVERRIDE_BODY); + Map bean = (Map) request.getAttribute(TableTag.FILTER_CONTENT_OVERRIDE_BODY); if (log.isDebugEnabled()) { diff --git a/displaytag/src/main/java/org/displaytag/localization/I18nWebworkAdapter.java b/displaytag/src/main/java/org/displaytag/localization/I18nWebworkAdapter.java index 53d310174..0763ffa4e 100644 --- a/displaytag/src/main/java/org/displaytag/localization/I18nWebworkAdapter.java +++ b/displaytag/src/main/java/org/displaytag/localization/I18nWebworkAdapter.java @@ -58,7 +58,7 @@ public Locale resolveLocale(HttpServletRequest request) Locale result = null; OgnlValueStack stack = ActionContext.getContext().getValueStack(); - Iterator iterator = stack.getRoot().iterator(); + Iterator iterator = stack.getRoot().iterator(); while (iterator.hasNext()) { Object o = iterator.next(); @@ -93,7 +93,7 @@ public String getResource(String resourceKey, String defaultValue, Tag tag, Page String message = null; OgnlValueStack stack = TagUtils.getStack(pageContext); - Iterator iterator = stack.getRoot().iterator(); + Iterator iterator = stack.getRoot().iterator(); while (iterator.hasNext()) { diff --git a/displaytag/src/main/java/org/displaytag/model/Cell.java b/displaytag/src/main/java/org/displaytag/model/Cell.java index 426574b6b..d91ec3138 100644 --- a/displaytag/src/main/java/org/displaytag/model/Cell.java +++ b/displaytag/src/main/java/org/displaytag/model/Cell.java @@ -29,7 +29,7 @@ * @author Fabrizio Giustina * @version $Revision$ ($Author$) */ -public class Cell implements Comparable, Cloneable +public class Cell implements Comparable, Cloneable { /** @@ -97,7 +97,7 @@ public int compareTo(Object obj, Collator collator) { String a = (String) this.staticValue; String b = (String) otherStatic; - return collator.compare(a,b); + return collator.compare(a, b); } else { @@ -114,7 +114,7 @@ public int compareTo(Object obj, Collator collator) * @see java.lang.Comparable#compareTo(Object) */ @Override - public int compareTo(Object obj) + public int compareTo(Cell obj) { return compareTo(obj, null); } diff --git a/displaytag/src/main/java/org/displaytag/model/DefaultComparator.java b/displaytag/src/main/java/org/displaytag/model/DefaultComparator.java index afd1bce43..f0b1a2e5d 100644 --- a/displaytag/src/main/java/org/displaytag/model/DefaultComparator.java +++ b/displaytag/src/main/java/org/displaytag/model/DefaultComparator.java @@ -21,7 +21,7 @@ * @author rapruitt * @version $Revision$ ($Author$) */ -public class DefaultComparator implements Comparator +public class DefaultComparator implements Comparator { /** @@ -64,7 +64,7 @@ public int compare(Object object1, Object object2) } else if (object1 instanceof Cell) { - return ((Cell)object1).compareTo(object2, collator); + return ((Cell) object1).compareTo(object2, collator); } else if (object1 instanceof Comparable && object2 instanceof Comparable) { diff --git a/displaytag/src/main/java/org/displaytag/model/RowSorter.java b/displaytag/src/main/java/org/displaytag/model/RowSorter.java index 38be251eb..9c0026de7 100644 --- a/displaytag/src/main/java/org/displaytag/model/RowSorter.java +++ b/displaytag/src/main/java/org/displaytag/model/RowSorter.java @@ -26,7 +26,7 @@ * @author Fabrizio Giustina * @version $Revision$ ($Author$) */ -public class RowSorter implements Comparator +public class RowSorter implements Comparator { /** @@ -196,9 +196,10 @@ public final boolean equals(Object object) { if (object instanceof RowSorter) { - return new EqualsBuilder().append(this.property, ((RowSorter) object).property).append( - this.columnIndex, - ((RowSorter) object).columnIndex).isEquals(); + return new EqualsBuilder() + .append(this.property, ((RowSorter) object).property) + .append(this.columnIndex, ((RowSorter) object).columnIndex) + .isEquals(); } return false; diff --git a/displaytag/src/main/java/org/displaytag/pagination/PaginatedList.java b/displaytag/src/main/java/org/displaytag/pagination/PaginatedList.java index ec39267ff..3ea474536 100644 --- a/displaytag/src/main/java/org/displaytag/pagination/PaginatedList.java +++ b/displaytag/src/main/java/org/displaytag/pagination/PaginatedList.java @@ -27,7 +27,7 @@ public interface PaginatedList * Returns the current partial list * @return the current partial list */ - List getList(); + List getList(); /** * Returns the page number of the partial list (starts from 1) diff --git a/displaytag/src/main/java/org/displaytag/pagination/PaginationHelper.java b/displaytag/src/main/java/org/displaytag/pagination/PaginationHelper.java index 8ef579953..9f6863fbe 100644 --- a/displaytag/src/main/java/org/displaytag/pagination/PaginationHelper.java +++ b/displaytag/src/main/java/org/displaytag/pagination/PaginationHelper.java @@ -22,8 +22,8 @@ * Class to help pagination when dealing with lists. *

*

- * 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); + +