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
This commit is contained in:
Nick Burch 2008-02-21 10:36:08 +00:00
parent 08c14adf33
commit 528bda2729
5 changed files with 16 additions and 1 deletions

View File

@ -73,7 +73,13 @@ public class SVRowHeader extends JList {
public Component getListCellRendererComponent( JList list, public Component getListCellRendererComponent( JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) { Object value, int index, boolean isSelected, boolean cellHasFocus) {
Dimension d = getPreferredSize(); 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; d.height = rowHeight+extraHeight;
setPreferredSize(d); setPreferredSize(d);
setText((value == null) ? "" : value.toString()); setText((value == null) ? "" : value.toString());

View File

@ -143,6 +143,10 @@ public class SViewer extends JApplet {
/**Main method*/ /**Main method*/
public static void main(String[] args) { 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(); SViewer applet = new SViewer();
applet.isStandalone = true; applet.isStandalone = true;
applet.filename = args[0]; applet.filename = args[0];

View File

@ -260,6 +260,9 @@ public class SViewerPanel extends JPanel {
/**Main method*/ /**Main method*/
public static void main(String[] args) { 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 { try {
FileInputStream in = new FileInputStream(args[0]); FileInputStream in = new FileInputStream(args[0]);
HSSFWorkbook wb = new HSSFWorkbook(in); HSSFWorkbook wb = new HSSFWorkbook(in);

View File

@ -36,6 +36,7 @@
<!-- Don't forget to update status.xml too! --> <!-- Don't forget to update status.xml too! -->
<release version="3.1-beta1" date="2008-??-??"> <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">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">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> <action dev="POI-DEVELOPERS" type="fix">44421 - Update Match function to properly support Area references</action>

View File

@ -33,6 +33,7 @@
<!-- Don't forget to update changes.xml too! --> <!-- Don't forget to update changes.xml too! -->
<changes> <changes>
<release version="3.1-beta1" date="2008-??-??"> <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">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">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> <action dev="POI-DEVELOPERS" type="fix">44421 - Update Match function to properly support Area references</action>