Fix bug #45338 - JDK 1.4/1.5 issue from r673997

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@674911 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-07-08 18:56:21 +00:00
parent 4fc756bd26
commit e9099a1cbe
1 changed files with 35 additions and 37 deletions

View File

@ -360,28 +360,28 @@ public class HSSFWorkbook extends POIDocument
log.log(POILogger.DEBUG, "convertLabelRecords exit"); log.log(POILogger.DEBUG, "convertLabelRecords exit");
} }
/** /**
* Retrieves the current policy on what to do when * Retrieves the current policy on what to do when
* getting missing or blank cells from a row. * getting missing or blank cells from a row.
* The default is to return blank and null cells. * The default is to return blank and null cells.
* {@link MissingCellPolicy} * {@link MissingCellPolicy}
*/ */
public MissingCellPolicy getMissingCellPolicy() { public MissingCellPolicy getMissingCellPolicy() {
return missingCellPolicy; return missingCellPolicy;
} }
/** /**
* Sets the policy on what to do when * Sets the policy on what to do when
* getting missing or blank cells from a row. * getting missing or blank cells from a row.
* This will then apply to all calls to * This will then apply to all calls to
* {@link HSSFRow.getCell()}. See * {@link HSSFRow.getCell()}. See
* {@link MissingCellPolicy} * {@link MissingCellPolicy}
*/ */
public void setMissingCellPolicy(MissingCellPolicy missingCellPolicy) { public void setMissingCellPolicy(MissingCellPolicy missingCellPolicy) {
this.missingCellPolicy = missingCellPolicy; this.missingCellPolicy = missingCellPolicy;
} }
/** /**
* sets the order of appearance for a given sheet. * sets the order of appearance for a given sheet.
* *
* @param sheetname the name of the sheet to reorder * @param sheetname the name of the sheet to reorder
@ -1020,11 +1020,11 @@ public class HSSFWorkbook extends POIDocument
String name, boolean italic, boolean strikeout, String name, boolean italic, boolean strikeout,
short typeOffset, byte underline) short typeOffset, byte underline)
{ {
for (short i=0; i<=getNumberOfFonts(); i++) { for (short i=0; i<=getNumberOfFonts(); i++) {
// Remember - there is no 4! // Remember - there is no 4!
if(i == 4) continue; if(i == 4) continue;
HSSFFont hssfFont = getFontAt(i); HSSFFont hssfFont = getFontAt(i);
if (hssfFont.getBoldweight() == boldWeight if (hssfFont.getBoldweight() == boldWeight
&& hssfFont.getColor() == color && hssfFont.getColor() == color
&& hssfFont.getFontHeight() == fontHeight && hssfFont.getFontHeight() == fontHeight
@ -1056,18 +1056,16 @@ public class HSSFWorkbook extends POIDocument
* @param idx index number * @param idx index number
* @return HSSFFont at the index * @return HSSFFont at the index
*/ */
public HSSFFont getFontAt(short idx) {
if(fonts == null) fonts = new Hashtable();
public HSSFFont getFontAt(short idx) // So we don't confuse users, give them back
{ // the same object every time, but create
if(fonts == null) fonts = new Hashtable(); // them lazily
Short sIdx = new Short(idx);
// So we don't confuse users, give them back if(fonts.containsKey(sIdx)) {
// the same object every time, but create return (HSSFFont)fonts.get(sIdx);
// them lazily }
Short sIdx = Short.valueOf(idx);
if(fonts.containsKey(sIdx)) {
return (HSSFFont)fonts.get(sIdx);
}
FontRecord font = workbook.getFontRecordAt(idx); FontRecord font = workbook.getFontRecordAt(idx);
HSSFFont retval = new HSSFFont(idx, font); HSSFFont retval = new HSSFFont(idx, font);