Fix generics warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1391885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2012-09-29 21:25:44 +00:00
parent a475de5785
commit aa358ace11

View File

@ -17,11 +17,12 @@
package org.apache.poi.hssf.usermodel; package org.apache.poi.hssf.usermodel;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import org.apache.poi.hssf.record.ExtendedFormatRecord; import org.apache.poi.hssf.record.ExtendedFormatRecord;
import org.apache.poi.hssf.record.FontRecord; import org.apache.poi.hssf.record.FontRecord;
import org.apache.poi.hssf.record.common.UnicodeString; import org.apache.poi.hssf.record.common.UnicodeString;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
/** /**
* Excel can get cranky if you give it files containing too * Excel can get cranky if you give it files containing too
@ -135,17 +136,13 @@ public class HSSFOptimiser {
// the new locations of the fonts // the new locations of the fonts
// Remember that one underlying unicode string // Remember that one underlying unicode string
// may be shared by multiple RichTextStrings! // may be shared by multiple RichTextStrings!
HashSet doneUnicodeStrings = new HashSet(); HashSet<UnicodeString> doneUnicodeStrings = new HashSet<UnicodeString>();
for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) { for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) {
HSSFSheet s = workbook.getSheetAt(sheetNum); HSSFSheet s = workbook.getSheetAt(sheetNum);
Iterator rIt = s.rowIterator(); for (Row row : s) {
while(rIt.hasNext()) { for (Cell cell : row) {
HSSFRow row = (HSSFRow)rIt.next(); if(cell.getCellType() == Cell.CELL_TYPE_STRING) {
Iterator cIt = row.cellIterator(); HSSFRichTextString rtr = (HSSFRichTextString)cell.getRichStringCellValue();
while(cIt.hasNext()) {
HSSFCell cell = (HSSFCell)cIt.next();
if(cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
HSSFRichTextString rtr = cell.getRichStringCellValue();
UnicodeString u = rtr.getRawUnicodeString(); UnicodeString u = rtr.getRawUnicodeString();
// Have we done this string already? // Have we done this string already?
@ -244,12 +241,9 @@ public class HSSFOptimiser {
// their new extended format records // their new extended format records
for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) { for(int sheetNum=0; sheetNum<workbook.getNumberOfSheets(); sheetNum++) {
HSSFSheet s = workbook.getSheetAt(sheetNum); HSSFSheet s = workbook.getSheetAt(sheetNum);
Iterator rIt = s.rowIterator(); for (Row row : s) {
while(rIt.hasNext()) { for (Cell cellI : row) {
HSSFRow row = (HSSFRow)rIt.next(); HSSFCell cell = (HSSFCell)cellI;
Iterator cIt = row.cellIterator();
while(cIt.hasNext()) {
HSSFCell cell = (HSSFCell)cIt.next();
short oldXf = cell.getCellValueRecord().getXFIndex(); short oldXf = cell.getCellValueRecord().getXFIndex();
HSSFCellStyle newStyle = workbook.getCellStyleAt( HSSFCellStyle newStyle = workbook.getCellStyleAt(
newPos[oldXf] newPos[oldXf]