From: Nick Burch Date: Wed, 13 Jan 2010 13:42:15 +0000 (+0000) Subject: Fix a few generics warnings X-Git-Tag: REL_3_7_BETA1~143 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0779f79cc78f7705385ac53d2e725614f1797436;p=poi.git Fix a few generics warnings git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@898748 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java index 0cde00dfb7..d71dca69af 100644 --- a/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java +++ b/src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java @@ -46,18 +46,18 @@ public abstract class AbstractEscherHolderRecord extends Record { } } - private List escherRecords; + private List escherRecords; private byte[] rawData; public AbstractEscherHolderRecord() { - escherRecords = new ArrayList(); + escherRecords = new ArrayList(); } public AbstractEscherHolderRecord(RecordInputStream in) { - escherRecords = new ArrayList(); + escherRecords = new ArrayList(); if (! DESERIALISE ) { rawData = in.readRemainder(); @@ -93,9 +93,9 @@ public abstract class AbstractEscherHolderRecord extends Record { buffer.append('[' + getRecordName() + ']' + nl); if (escherRecords.size() == 0) buffer.append("No Escher Records Decoded" + nl); - for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) + for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) { - EscherRecord r = (EscherRecord) iterator.next(); + EscherRecord r = iterator.next(); buffer.append(r.toString()); } buffer.append("[/" + getRecordName() + ']' + nl); @@ -120,9 +120,9 @@ public abstract class AbstractEscherHolderRecord extends Record { LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); int pos = offset + 4; - for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) + for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) { - EscherRecord r = (EscherRecord) iterator.next(); + EscherRecord r = iterator.next(); pos += r.serialize( pos, data, new NullEscherSerializationListener() ); } return getRecordSize(); @@ -133,9 +133,9 @@ public abstract class AbstractEscherHolderRecord extends Record { return rawData.length; } int size = 0; - for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) + for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) { - EscherRecord r = (EscherRecord) iterator.next(); + EscherRecord r = iterator.next(); size += r.getRecordSize(); } return size; @@ -160,7 +160,7 @@ public abstract class AbstractEscherHolderRecord extends Record { return escherRecords.add( element ); } - public List getEscherRecords() + public List getEscherRecords() { return escherRecords; } @@ -176,8 +176,8 @@ public abstract class AbstractEscherHolderRecord extends Record { * then return that. */ public EscherContainerRecord getEscherContainer() { - for(Iterator it = escherRecords.iterator(); it.hasNext();) { - Object er = it.next(); + for(Iterator it = escherRecords.iterator(); it.hasNext();) { + EscherRecord er = it.next(); if(er instanceof EscherContainerRecord) { return (EscherContainerRecord)er; } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 7e2a74c38d..d71d62dbd9 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -67,6 +67,7 @@ import org.apache.poi.hssf.util.CellReference; import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.usermodel.CreationHelper; +import org.apache.poi.ss.usermodel.PictureData; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; import org.apache.poi.ss.formula.FormulaType; import org.apache.poi.util.POILogFactory; @@ -1568,18 +1569,18 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss * * @return the list of pictures (a list of {@link HSSFPictureData} objects.) */ - public List getAllPictures() + public List getAllPictures() { // The drawing group record always exists at the top level, so we won't need to do this recursively. - List pictures = new ArrayList(); - Iterator recordIter = workbook.getRecords().iterator(); + List pictures = new ArrayList(); + Iterator recordIter = workbook.getRecords().iterator(); while (recordIter.hasNext()) { - Object obj = recordIter.next(); - if (obj instanceof AbstractEscherHolderRecord) + Record r = recordIter.next(); + if (r instanceof AbstractEscherHolderRecord) { - ((AbstractEscherHolderRecord) obj).decode(); - List escherRecords = ((AbstractEscherHolderRecord) obj).getEscherRecords(); + ((AbstractEscherHolderRecord) r).decode(); + List escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords(); searchForPictures(escherRecords, pictures); } } @@ -1592,7 +1593,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss * @param escherRecords the escher records. * @param pictures the list to populate with the pictures. */ - private void searchForPictures(List escherRecords, List pictures) + private void searchForPictures(List escherRecords, List pictures) { Iterator recordIter = escherRecords.iterator(); while (recordIter.hasNext()) diff --git a/src/java/org/apache/poi/ss/usermodel/Workbook.java b/src/java/org/apache/poi/ss/usermodel/Workbook.java index 99f4ddba89..53ddb8fa53 100644 --- a/src/java/org/apache/poi/ss/usermodel/Workbook.java +++ b/src/java/org/apache/poi/ss/usermodel/Workbook.java @@ -405,7 +405,7 @@ public interface Workbook { * * @return the list of pictures (a list of {@link PictureData} objects.) */ - List getAllPictures(); + List getAllPictures(); /** * Returns an object that handles instantiating concrete