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

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

index 8540cb237bd6ae0daef2dbf423160de80dfc20e6..5b9a519b287ed0fa8d9e77355b12a05bc6a1afb5 100644 (file)
@@ -132,7 +132,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('"');
index 9f4d1e629b842745d8a76306a91c15f866c60b12..3c79e1c4fa5c24b8de022e7c0752e51281f4e078 100644 (file)
@@ -133,7 +133,7 @@ public class FromHowTo {
                 throws SAXException {
             // Process the last contents as required.
             // Do now, as characters() may be called more than once
-            if(nextIsString && !lastContents.isEmpty()) {
+            if(nextIsString && !lastContents.trim().isEmpty()) {
                 Integer idx = Integer.valueOf(lastContents);
                 lastContents = lruCache.get(idx);
                 if (lastContents == null && !lruCache.containsKey(idx)) {