You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2022/11/13 19:22:13 UTC

svn commit: r1905273 - in /poi/trunk: poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/ poi/src/test/java/org/apache/poi/hssf/model/ poi/src/test/java/org/apache/poi/hssf/usermodel/ poi/src/te...

Author: centic
Date: Sun Nov 13 19:22:13 2022
New Revision: 1905273

URL: http://svn.apache.org/viewvc?rev=1905273&view=rev
Log:
Adjust tests, comments, JavaDoc, IDE suggestions

Add more output for a flaky test which sometimes fails on very slow hardware

Shutdown in tests gracefully
Otherwise an NPE may "hide" a test-failure

Modified:
    poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java
    poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
    poi/trunk/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java
    poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestMatrixFormulasFromBinarySpreadsheet.java
    poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java?rev=1905273&r1=1905272&r2=1905273&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java Sun Nov 13 19:22:13 2022
@@ -39,7 +39,7 @@ public class XWPFPictureData extends POI
     private static int MAX_IMAGE_SIZE = DEFAULT_MAX_IMAGE_SIZE;
 
     /**
-     * @param length the max image size allowed for XSSF pictures
+     * @param length the max image size allowed for XWPF pictures
      */
     public static void setMaxImageSize(int length) {
         MAX_IMAGE_SIZE = length;

Modified: poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1905273&r1=1905272&r2=1905273&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Sun Nov 13 19:22:13 2022
@@ -36,6 +36,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
+import java.time.Duration;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -3312,7 +3313,9 @@ public final class TestXSSFBugs extends
                 }
             LOG.atInfo().log(between(start, now()));
 
-            assertTrue(between(start, now()).getSeconds() < 25);
+            assertTrue(between(start, now()).getSeconds() < 25,
+                    "Had start: " + start + ", now: " + now() +
+                            ", diff: " + Duration.between(start, now()).getSeconds());
         }
     }
 

Modified: poi/trunk/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java?rev=1905273&r1=1905272&r2=1905273&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/hssf/model/TestRVA.java Sun Nov 13 19:22:13 2022
@@ -53,8 +53,12 @@ final class TestRVA {
 
     @AfterAll
     public static void closeResource() throws Exception {
-        workbook.close();
-        poifs.close();
+        if (workbook != null) {
+            workbook.close();
+        }
+        if (poifs != null) {
+            poifs.close();
+        }
     }
 
     public static Stream<Arguments> data() throws Exception {

Modified: poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestMatrixFormulasFromBinarySpreadsheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestMatrixFormulasFromBinarySpreadsheet.java?rev=1905273&r1=1905272&r2=1905273&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestMatrixFormulasFromBinarySpreadsheet.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/hssf/usermodel/TestMatrixFormulasFromBinarySpreadsheet.java Sun Nov 13 19:22:13 2022
@@ -101,7 +101,9 @@ final class TestMatrixFormulasFromBinary
     @AfterAll
     public static void closeResource() throws Exception {
         LocaleUtil.setUserLocale(userLocale);
-        workbook.close();
+        if (workbook != null) {
+            workbook.close();
+        }
     }
 
     /* generating parameter instances */

Modified: poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java?rev=1905273&r1=1905272&r2=1905273&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/eval/TestFormulasFromSpreadsheet.java Sun Nov 13 19:22:13 2022
@@ -100,7 +100,9 @@ public final class TestFormulasFromSprea
     @AfterAll
     public static void closeResource() throws Exception {
         LocaleUtil.setUserLocale(userLocale);
-        workbook.close();
+        if (workbook != null) {
+            workbook.close();
+        }
     }
 
     public static Stream<Arguments> data() {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org