aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2008-02-21 10:36:08 +0000
committerNick Burch <nick@apache.org>2008-02-21 10:36:08 +0000
commitf99adefb36eca909c2e82ed639da289f37e1a09c (patch)
tree2721587b45cbfa6dbe83032e0289a34149f2d17a
parent5f2db43b4dcb73042367e1311b67d67b6cf48eea (diff)
downloadpoi-f99adefb36eca909c2e82ed639da289f37e1a09c.tar.gz
poi-f99adefb36eca909c2e82ed639da289f37e1a09c.zip
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
-rw-r--r--src/contrib/src/org/apache/poi/hssf/contrib/view/SVRowHeader.java8
-rw-r--r--src/contrib/src/org/apache/poi/hssf/contrib/view/SViewer.java4
-rw-r--r--src/contrib/src/org/apache/poi/hssf/contrib/view/SViewerPanel.java3
-rw-r--r--src/documentation/content/xdocs/changes.xml1
-rw-r--r--src/documentation/content/xdocs/status.xml1
5 files changed, 16 insertions, 1 deletions
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 @@
<!-- 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>
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 @@
<!-- 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>