summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-12-01 11:49:25 +0000
committerPJ Fanning <fanningpj@apache.org>2021-12-01 11:49:25 +0000
commitc8d61cbfe31d0d170cc00d447174bd886faa4ac7 (patch)
tree83722f62194b19d91ab96a5a28e324c9e487d8cb
parentadd71cb80adb570eddfcaf804e89c1c26bc4a38c (diff)
downloadpoi-c8d61cbfe31d0d170cc00d447174bd886faa4ac7.tar.gz
poi-c8d61cbfe31d0d170cc00d447174bd886faa4ac7.zip
code formatting
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895454 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java16
-rw-r--r--poi/src/test/java/org/apache/poi/hpsf/basic/TestHPSFBugs.java26
2 files changed, 26 insertions, 16 deletions
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java
index 36ad393a51..0f2039677a 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java
@@ -139,4 +139,20 @@ public final class TestHWPFWrite extends HWPFTestCase {
assertThrows(IllegalStateException.class, doc::write);
}
}
+
+ @Test
+ void testBug65436() throws IOException {
+ UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ try (HWPFDocument doc = HWPFTestDataSamples.openSampleFile("SampleDoc.doc")) {
+ doc
+ Range r = doc.getRange();
+ assertEquals("I am a test document\r", r.getParagraph(0).text());
+ doc.write(baos);
+ }
+
+ try (HWPFDocument doc = new HWPFDocument(baos.toInputStream())) {
+ Range r = doc.getRange();
+ assertEquals("I am a test document\r", r.getParagraph(0).text());
+ }
+ }
}
diff --git a/poi/src/test/java/org/apache/poi/hpsf/basic/TestHPSFBugs.java b/poi/src/test/java/org/apache/poi/hpsf/basic/TestHPSFBugs.java
index 001fc2b238..bd86d39cc2 100644
--- a/poi/src/test/java/org/apache/poi/hpsf/basic/TestHPSFBugs.java
+++ b/poi/src/test/java/org/apache/poi/hpsf/basic/TestHPSFBugs.java
@@ -17,27 +17,21 @@
package org.apache.poi.hpsf.basic;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import org.apache.poi.POIDataSamples;
import org.apache.poi.POIDocument;
-import org.apache.poi.hpsf.DocumentSummaryInformation;
-import org.apache.poi.hpsf.HPSFPropertiesOnlyDocument;
-import org.apache.poi.hpsf.NoPropertySetStreamException;
-import org.apache.poi.hpsf.PropertySetFactory;
-import org.apache.poi.hpsf.SummaryInformation;
+import org.apache.poi.hpsf.*;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.jupiter.api.Test;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+
+import static org.junit.jupiter.api.Assertions.*;
+
/**
* Tests various bugs have been fixed
*/
@@ -112,12 +106,12 @@ final class TestHPSFBugs {
@Test
void test54233() throws IOException, NoPropertySetStreamException {
try (InputStream is = _samples.openResourceAsStream("TestNon4ByteBoundary.doc");
- POIFSFileSystem fs = new POIFSFileSystem(is)) {
+ POIFSFileSystem fs = new POIFSFileSystem(is)) {
SummaryInformation si = (SummaryInformation)
- PropertySetFactory.create(fs.getRoot(), SummaryInformation.DEFAULT_STREAM_NAME);
+ PropertySetFactory.create(fs.getRoot(), SummaryInformation.DEFAULT_STREAM_NAME);
DocumentSummaryInformation dsi = (DocumentSummaryInformation)
- PropertySetFactory.create(fs.getRoot(), DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+ PropertySetFactory.create(fs.getRoot(), DocumentSummaryInformation.DEFAULT_STREAM_NAME);
// Test
assertEquals("Microsoft Word 10.0", si.getApplicationName());