]> source.dussan.org Git - poi.git/commitdiff
Fix from Josh from bug #44456 - Update contrib SViewer to not fail if a HSSFRow is...
authorNick Burch <nick@apache.org>
Thu, 21 Feb 2008 10:36:08 +0000 (10:36 +0000)
committerNick Burch <nick@apache.org>
Thu, 21 Feb 2008 10:36:08 +0000 (10:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@629738 13f79535-47bb-0310-9956-ffa450edef68

src/contrib/src/org/apache/poi/hssf/contrib/view/SVRowHeader.java
src/contrib/src/org/apache/poi/hssf/contrib/view/SViewer.java
src/contrib/src/org/apache/poi/hssf/contrib/view/SViewerPanel.java
src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml

index f53d9cd89d5a3535b7655a0666f26883362011bc..fa76b1e434a695ecc439563771ec0261f5e6c78d 100644 (file)
@@ -73,7 +73,13 @@ public class SVRowHeader extends JList {
     public Component getListCellRendererComponent( JList list,
            Object value, int index, boolean isSelected, boolean cellHasFocus) {
       Dimension d = getPreferredSize();
-      int rowHeight = (int)sheet.getRow(index).getHeightInPoints();
+      HSSFRow row = sheet.getRow(index);
+      int rowHeight;
+      if(row == null) {
+         rowHeight = (int)sheet.getDefaultRowHeightInPoints();
+      } else {
+         rowHeight = (int)row.getHeightInPoints();
+      }
       d.height = rowHeight+extraHeight;
       setPreferredSize(d);
       setText((value == null) ? "" : value.toString());
index 7d451d7c76a5c4b57891d655dd7e11750af19419..a3756ce6525ec5a19d82dacd3f5719c994724965 100644 (file)
@@ -143,6 +143,10 @@ public class SViewer extends JApplet {
 
   /**Main method*/
   public static void main(String[] args) {
+    if(args.length < 1) {
+      throw new IllegalArgumentException("A filename to view must be supplied as the first argument, but none was given");
+    }
+
     SViewer applet = new SViewer();
     applet.isStandalone = true;
     applet.filename = args[0];
index 3cd2c1c06264aa59e8cf651e7070a86a55155a7d..c400d4fe48b0a718bbc8bf1b7a9393ea6082c549 100644 (file)
@@ -260,6 +260,9 @@ public class SViewerPanel extends JPanel {
 
   /**Main method*/
   public static void main(String[] args) {
+    if(args.length < 1) {
+      throw new IllegalArgumentException("A filename to view must be supplied as the first argument, but none was given");
+    }
     try {
       FileInputStream in = new FileInputStream(args[0]);
       HSSFWorkbook wb = new HSSFWorkbook(in);
index 98c525405df4b99657e859bb0d43aa1ac47d8580..46fdb22acdf9ac0725de86f08d12c18daba1942c 100644 (file)
@@ -36,6 +36,7 @@
 
                <!-- Don't forget to update status.xml too! -->
         <release version="3.1-beta1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">44456 - Fix the contrib SViewer / SViewerPanel to not fail on sheets with missing rows</action>
            <action dev="POI-DEVELOPERS" type="fix">44403 - Further support for unusual, but valid, arguments to the Mid function</action>
            <action dev="POI-DEVELOPERS" type="fix">44410 - Support for whole-column ranges, such as C:C, in formula strings and the formula evaluator</action>
            <action dev="POI-DEVELOPERS" type="fix">44421 - Update Match function to properly support Area references</action>
index 82c20692908306a5a9edb2450579f6493e2f6a90..fec81a1e1c3935761c2b4202f514246e76eb2f19 100644 (file)
@@ -33,6 +33,7 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.1-beta1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">44456 - Fix the contrib SViewer / SViewerPanel to not fail on sheets with missing rows</action>
            <action dev="POI-DEVELOPERS" type="fix">44403 - Further support for unusual, but valid, arguments to the Mid function</action>
            <action dev="POI-DEVELOPERS" type="fix">44410 - Support for whole-column ranges, such as C:C, in formula strings and the formula evaluator</action>
            <action dev="POI-DEVELOPERS" type="fix">44421 - Update Match function to properly support Area references</action>