]> source.dussan.org Git - poi.git/commitdiff
fix several findbugs SF_SWITCH_NO_DEFAULT warnings
authorJaven O'Neal <onealj@apache.org>
Tue, 12 Apr 2016 11:12:57 +0000 (11:12 +0000)
committerJaven O'Neal <onealj@apache.org>
Tue, 12 Apr 2016 11:12:57 +0000 (11:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1738765 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/dev/FormulaViewer.java
src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
src/java/org/apache/poi/hssf/extractor/ExcelExtractor.java
src/java/org/apache/poi/hssf/model/CommentShape.java
src/java/org/apache/poi/hssf/model/InternalWorkbook.java
src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java

index 5ea0331ad777d5440e50e35321a4e0d7ccf01187..8fce8d2e9e9cdca5d93411182ea2f74dc1ebf0c2 100644 (file)
@@ -110,6 +110,8 @@ public class FormulaViewer
                 case Ptg.CLASS_ARRAY :
                     buf.append("ARRAY");
                     break;
+                default:
+                    throwInvalidRVAToken(token);
             }
             
             buf.append(sep);
@@ -125,6 +127,8 @@ public class FormulaViewer
                     case Ptg.CLASS_ARRAY :
                         buf.append("ARRAY");
                         break;
+                    default:
+                        throwInvalidRVAToken(token);
                 }
             }else {
                 buf.append("VALUE");
@@ -173,12 +177,18 @@ public class FormulaViewer
                 case Ptg.CLASS_ARRAY :
                     buf.append("(A)");
                     break;
+                default:
+                    throwInvalidRVAToken(token);
             }
             buf.append(' ');
         } 
         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)
     {
index 503f8d81b17830cadfbbe28a5e080595758346e6..ea9b70d88d1388dca66c6ffc56b8288e9eb8fedb 100644 (file)
@@ -134,6 +134,8 @@ public final class MissingRecordAwareHSSFListener implements HSSFListener {
                                        thisRow = nrec.getRow();
                                        thisColumn = nrec.getColumn();
                                        break;
+                               default:
+                                       break;
                        }
                }
 
index 27df0c8f178556cd59fb9d83dc98f730dfb74171..f95c7b2a9a7fefaed87e0abe7a1ad2d503c1488c 100644 (file)
@@ -367,6 +367,8 @@ public class ExcelExtractor extends POIOLE2TextExtractor implements org.apache.p
                                                                                case HSSFCell.CELL_TYPE_ERROR:
                                                                                        text.append(ErrorEval.getText(cell.getErrorCellValue()));
                                                                                        break;
+                                                                               default:
+                                                                                       throw new IllegalStateException("Unexpected cell cached formula result type: " + cell.getCachedFormulaResultType());
 
                                                                        }
                                                                }
index aa61a3676b1bbb65055699560b3a54825c30548f..ba1fad9770bba4e5d3395408d7ecdcd1f57a6cce 100644 (file)
@@ -116,6 +116,8 @@ public final class CommentShape extends TextboxShape {
                 case EscherProperties.LINESTYLE__COLOR:
                     iterator.remove();
                     break;
+                default:
+                    break;
             }
         }
 
index 7ca7c942df3814b72e686c0a5fd3694e635af4e9..12854558afc1825ee52c2a14a8dec3668cf4bc3f 100644 (file)
@@ -334,7 +334,11 @@ public final class InternalWorkbook {
                     if (log.check( POILogger.DEBUG ))
                         log.log(DEBUG, "found NameComment at " + k);
                     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);
         }
@@ -352,6 +356,8 @@ public final class InternalWorkbook {
                 case HyperlinkRecord.sid:
                     retval.hyperlinks.add((HyperlinkRecord)rec);
                     break;
+                default:
+                    break;
             }
         }
 
@@ -1682,6 +1688,9 @@ public final class InternalWorkbook {
                 retval.setAdtlPaletteOptions(( short ) 0);
                 retval.setFillPaletteOptions(( short ) 0x20c0);
                 break;
+
+            default:
+                throw new IllegalStateException("Unrecognized format id: " + id);
         }
         return retval;
     }
@@ -1754,6 +1763,9 @@ public final class InternalWorkbook {
                 retval.setBuiltinStyle(5);
                 retval.setOutlineStyleLevel(( byte ) 0xffffffff);
                 break;
+
+            default:
+                throw new IllegalStateException("Unrecognized style id: " + id);
         }
         return retval;
     }
index e31f2f5808185fe1f361616ce6c06d364975af51..6e9911be34dbb873b63d22510f2d860a2efda59c 100644 (file)
@@ -186,6 +186,9 @@ public class HSSFCell implements Cell {
             case CELL_TYPE_FORMULA :
                 _stringValue=new HSSFRichTextString(((FormulaRecordAggregate) cval).getStringValue());
                 break;
+
+            default :
+                break;
         }
     }
 
@@ -422,6 +425,8 @@ public class HSSFCell implements Cell {
                 errRec.setRow(row);
                 _record = errRec;
                 break;
+            default :
+                throw new IllegalStateException("Invalid cell type: " + cellType);
         }
         if (cellType != _cellType &&
             _cellType!=-1 )  // Special Value to indicate an uninitialized Cell
@@ -1088,6 +1093,8 @@ public class HSSFCell implements Cell {
             case HSSFHyperlink.LINK_DOCUMENT:
                 link.setLabel("place");
                 break;
+            default:
+                break;
         }
 
         List<RecordBase> records = _sheet.getSheet().getRecords();
index eff2f218d383f332b1ca1c5017a41e7791b0255a..6000485122715e8cbbbb344b58663dcd0ce1ee9a 100644 (file)
@@ -409,6 +409,7 @@ public class ExcelToFoConverter extends AbstractExcelConverter
             triplet.bold = true;
             break;
         case HSSFFont.BOLDWEIGHT_NORMAL:
+        default:
             triplet.bold = false;
             break;
         }