]> source.dussan.org Git - poi.git/commitdiff
try to make examples more robust - to fix integration tests
authorPJ Fanning <fanningpj@apache.org>
Thu, 23 Jul 2020 07:23:44 +0000 (07:23 +0000)
committerPJ Fanning <fanningpj@apache.org>
Thu, 23 Jul 2020 07:23:44 +0000 (07:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1880185 13f79535-47bb-0310-9956-ffa450edef68

src/examples/src/org/apache/poi/examples/xssf/eventusermodel/FromHowTo.java
src/examples/src/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java

index 4b376a979dec525cce287fd44f0e108ce361cba2..d61b4adb380989e4f8a85cfec39ad393f54a127a 100644 (file)
@@ -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)) {
index 17865383661dd1dc77d28ed9552352cdf17e79a7..627e0f7fb51dc37edbe719c9b7a35f333ebda2df 100644 (file)
@@ -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('"');