aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2020-07-23 07:23:44 +0000
committerPJ Fanning <fanningpj@apache.org>2020-07-23 07:23:44 +0000
commit6f3e38c18aec7169b658a4a5a17ab7d6c46dd114 (patch)
tree02c0e02a884a2aac74ae98eb7f0637477fd7139a /src/examples
parent197570d18df5b0ea50a6135c3a49646ce69f9d59 (diff)
downloadpoi-6f3e38c18aec7169b658a4a5a17ab7d6c46dd114.tar.gz
poi-6f3e38c18aec7169b658a4a5a17ab7d6c46dd114.zip
try to make examples more robust - to fix integration tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1880185 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/src/org/apache/poi/examples/xssf/eventusermodel/FromHowTo.java2
-rw-r--r--src/examples/src/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/examples/src/org/apache/poi/examples/xssf/eventusermodel/FromHowTo.java b/src/examples/src/org/apache/poi/examples/xssf/eventusermodel/FromHowTo.java
index 4b376a979d..d61b4adb38 100644
--- a/src/examples/src/org/apache/poi/examples/xssf/eventusermodel/FromHowTo.java
+++ b/src/examples/src/org/apache/poi/examples/xssf/eventusermodel/FromHowTo.java
@@ -132,7 +132,7 @@ public class FromHowTo {
throws SAXException {
// Process the last contents as required.
// Do now, as characters() may be called more than once
- if(nextIsString) {
+ if(nextIsString && !lastContents.trim().isEmpty()) {
Integer idx = Integer.valueOf(lastContents);
lastContents = lruCache.get(idx);
if (lastContents == null && !lruCache.containsKey(idx)) {
diff --git a/src/examples/src/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java b/src/examples/src/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java
index 1786538366..627e0f7fb5 100644
--- a/src/examples/src/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java
+++ b/src/examples/src/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java
@@ -135,7 +135,7 @@ public class XLSX2CSV {
//noinspection ResultOfMethodCallIgnored
Double.parseDouble(formattedValue);
output.append(formattedValue);
- } catch (NumberFormatException e) {
+ } catch (Exception e) {
output.append('"');
output.append(formattedValue);
output.append('"');