From: Nick Burch Date: Thu, 21 Feb 2008 10:36:08 +0000 (+0000) Subject: Fix from Josh from bug #44456 - Update contrib SViewer to not fail if a HSSFRow is... X-Git-Tag: REL_3_0_3_BETA1~126 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f99adefb36eca909c2e82ed639da289f37e1a09c;p=poi.git Fix from Josh from bug #44456 - Update contrib SViewer to not fail if a HSSFRow is null git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@629738 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/contrib/src/org/apache/poi/hssf/contrib/view/SVRowHeader.java b/src/contrib/src/org/apache/poi/hssf/contrib/view/SVRowHeader.java index f53d9cd89d..fa76b1e434 100644 --- a/src/contrib/src/org/apache/poi/hssf/contrib/view/SVRowHeader.java +++ b/src/contrib/src/org/apache/poi/hssf/contrib/view/SVRowHeader.java @@ -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()); diff --git a/src/contrib/src/org/apache/poi/hssf/contrib/view/SViewer.java b/src/contrib/src/org/apache/poi/hssf/contrib/view/SViewer.java index 7d451d7c76..a3756ce652 100644 --- a/src/contrib/src/org/apache/poi/hssf/contrib/view/SViewer.java +++ b/src/contrib/src/org/apache/poi/hssf/contrib/view/SViewer.java @@ -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]; diff --git a/src/contrib/src/org/apache/poi/hssf/contrib/view/SViewerPanel.java b/src/contrib/src/org/apache/poi/hssf/contrib/view/SViewerPanel.java index 3cd2c1c062..c400d4fe48 100644 --- a/src/contrib/src/org/apache/poi/hssf/contrib/view/SViewerPanel.java +++ b/src/contrib/src/org/apache/poi/hssf/contrib/view/SViewerPanel.java @@ -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); diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 98c525405d..46fdb22acd 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -36,6 +36,7 @@ + 44456 - Fix the contrib SViewer / SViewerPanel to not fail on sheets with missing rows 44403 - Further support for unusual, but valid, arguments to the Mid function 44410 - Support for whole-column ranges, such as C:C, in formula strings and the formula evaluator 44421 - Update Match function to properly support Area references diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 82c2069290..fec81a1e1c 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -33,6 +33,7 @@ + 44456 - Fix the contrib SViewer / SViewerPanel to not fail on sheets with missing rows 44403 - Further support for unusual, but valid, arguments to the Mid function 44410 - Support for whole-column ranges, such as C:C, in formula strings and the formula evaluator 44421 - Update Match function to properly support Area references