fix several findbugs SF_SWITCH_NO_DEFAULT warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1738765 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-04-12 11:12:57 +00:00
parent aa6083ce0a
commit cb5544ad9f
7 changed files with 37 additions and 1 deletions

View File

@ -110,6 +110,8 @@ public class FormulaViewer
case Ptg.CLASS_ARRAY : case Ptg.CLASS_ARRAY :
buf.append("ARRAY"); buf.append("ARRAY");
break; break;
default:
throwInvalidRVAToken(token);
} }
buf.append(sep); buf.append(sep);
@ -125,6 +127,8 @@ public class FormulaViewer
case Ptg.CLASS_ARRAY : case Ptg.CLASS_ARRAY :
buf.append("ARRAY"); buf.append("ARRAY");
break; break;
default:
throwInvalidRVAToken(token);
} }
}else { }else {
buf.append("VALUE"); buf.append("VALUE");
@ -173,12 +177,18 @@ public class FormulaViewer
case Ptg.CLASS_ARRAY : case Ptg.CLASS_ARRAY :
buf.append("(A)"); buf.append("(A)");
break; break;
default:
throwInvalidRVAToken(token);
} }
buf.append(' '); buf.append(' ');
} }
return buf.toString(); return buf.toString();
} }
private static void throwInvalidRVAToken(Ptg token) {
throw new IllegalStateException("Invalid RVA type (" + token.getPtgClass() + "). This should never happen.");
}
private static String composeFormula(FormulaRecord record) private static String composeFormula(FormulaRecord record)
{ {

View File

@ -134,6 +134,8 @@ public final class MissingRecordAwareHSSFListener implements HSSFListener {
thisRow = nrec.getRow(); thisRow = nrec.getRow();
thisColumn = nrec.getColumn(); thisColumn = nrec.getColumn();
break; break;
default:
break;
} }
} }

View File

@ -367,6 +367,8 @@ public class ExcelExtractor extends POIOLE2TextExtractor implements org.apache.p
case HSSFCell.CELL_TYPE_ERROR: case HSSFCell.CELL_TYPE_ERROR:
text.append(ErrorEval.getText(cell.getErrorCellValue())); text.append(ErrorEval.getText(cell.getErrorCellValue()));
break; break;
default:
throw new IllegalStateException("Unexpected cell cached formula result type: " + cell.getCachedFormulaResultType());
} }
} }

View File

@ -116,6 +116,8 @@ public final class CommentShape extends TextboxShape {
case EscherProperties.LINESTYLE__COLOR: case EscherProperties.LINESTYLE__COLOR:
iterator.remove(); iterator.remove();
break; break;
default:
break;
} }
} }

View File

@ -334,7 +334,11 @@ public final class InternalWorkbook {
if (log.check( POILogger.DEBUG )) if (log.check( POILogger.DEBUG ))
log.log(DEBUG, "found NameComment at " + k); log.log(DEBUG, "found NameComment at " + k);
retval.commentRecords.put(ncr.getNameText(), ncr); retval.commentRecords.put(ncr.getNameText(), ncr);
default : break;
default:
if (log.check( POILogger.DEBUG ))
log.log(DEBUG, "ignoring record (sid=" + rec.getSid() + ") at " + k);
break;
} }
records.add(rec); records.add(rec);
} }
@ -352,6 +356,8 @@ public final class InternalWorkbook {
case HyperlinkRecord.sid: case HyperlinkRecord.sid:
retval.hyperlinks.add((HyperlinkRecord)rec); retval.hyperlinks.add((HyperlinkRecord)rec);
break; break;
default:
break;
} }
} }
@ -1682,6 +1688,9 @@ public final class InternalWorkbook {
retval.setAdtlPaletteOptions(( short ) 0); retval.setAdtlPaletteOptions(( short ) 0);
retval.setFillPaletteOptions(( short ) 0x20c0); retval.setFillPaletteOptions(( short ) 0x20c0);
break; break;
default:
throw new IllegalStateException("Unrecognized format id: " + id);
} }
return retval; return retval;
} }
@ -1754,6 +1763,9 @@ public final class InternalWorkbook {
retval.setBuiltinStyle(5); retval.setBuiltinStyle(5);
retval.setOutlineStyleLevel(( byte ) 0xffffffff); retval.setOutlineStyleLevel(( byte ) 0xffffffff);
break; break;
default:
throw new IllegalStateException("Unrecognized style id: " + id);
} }
return retval; return retval;
} }

View File

@ -186,6 +186,9 @@ public class HSSFCell implements Cell {
case CELL_TYPE_FORMULA : case CELL_TYPE_FORMULA :
_stringValue=new HSSFRichTextString(((FormulaRecordAggregate) cval).getStringValue()); _stringValue=new HSSFRichTextString(((FormulaRecordAggregate) cval).getStringValue());
break; break;
default :
break;
} }
} }
@ -422,6 +425,8 @@ public class HSSFCell implements Cell {
errRec.setRow(row); errRec.setRow(row);
_record = errRec; _record = errRec;
break; break;
default :
throw new IllegalStateException("Invalid cell type: " + cellType);
} }
if (cellType != _cellType && if (cellType != _cellType &&
_cellType!=-1 ) // Special Value to indicate an uninitialized Cell _cellType!=-1 ) // Special Value to indicate an uninitialized Cell
@ -1088,6 +1093,8 @@ public class HSSFCell implements Cell {
case HSSFHyperlink.LINK_DOCUMENT: case HSSFHyperlink.LINK_DOCUMENT:
link.setLabel("place"); link.setLabel("place");
break; break;
default:
break;
} }
List<RecordBase> records = _sheet.getSheet().getRecords(); List<RecordBase> records = _sheet.getSheet().getRecords();

View File

@ -409,6 +409,7 @@ public class ExcelToFoConverter extends AbstractExcelConverter
triplet.bold = true; triplet.bold = true;
break; break;
case HSSFFont.BOLDWEIGHT_NORMAL: case HSSFFont.BOLDWEIGHT_NORMAL:
default:
triplet.bold = false; triplet.bold = false;
break; break;
} }