aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2018-05-01 18:22:00 +0000
committerAndreas Beeker <kiwiwings@apache.org>2018-05-01 18:22:00 +0000
commit28e662c5a72180e39c28b9d8cf457ea90185de50 (patch)
tree6cd4023aeaebb261123f6a8ded942c496591a3fe /src/testcases/org
parente73282a9e8425d5bc320696f68683a70c9de137e (diff)
downloadpoi-28e662c5a72180e39c28b9d8cf457ea90185de50.tar.gz
poi-28e662c5a72180e39c28b9d8cf457ea90185de50.zip
Cleanup Biff8EncryptionKey usage and use HPSF constants instead of duplicated strings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1830705 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
-rw-r--r--src/testcases/org/apache/poi/TestPOIDocumentMain.java6
-rw-r--r--src/testcases/org/apache/poi/hpsf/basic/TestBasic.java4
-rw-r--r--src/testcases/org/apache/poi/hpsf/basic/TestEmptyProperties.java2
-rw-r--r--src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java2
-rw-r--r--src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java3
-rw-r--r--src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java78
-rw-r--r--src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java9
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java32
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java10
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestCryptoAPI.java31
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestNonStandardWorkbookStreamNames.java10
-rw-r--r--src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java26
-rw-r--r--src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java6
-rw-r--r--src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java7
14 files changed, 100 insertions, 126 deletions
diff --git a/src/testcases/org/apache/poi/TestPOIDocumentMain.java b/src/testcases/org/apache/poi/TestPOIDocumentMain.java
index 83668b5c70..8910f4ed52 100644
--- a/src/testcases/org/apache/poi/TestPOIDocumentMain.java
+++ b/src/testcases/org/apache/poi/TestPOIDocumentMain.java
@@ -25,7 +25,9 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import org.apache.poi.hpsf.DocumentSummaryInformation;
import org.apache.poi.hpsf.HPSFPropertiesOnlyDocument;
+import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
@@ -89,10 +91,10 @@ public final class TestPOIDocumentMain {
// Should now hold them
assertNotNull(
- outFS.createDocumentInputStream("\005SummaryInformation")
+ outFS.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME)
);
assertNotNull(
- outFS.createDocumentInputStream("\005DocumentSummaryInformation")
+ outFS.createDocumentInputStream(DocumentSummaryInformation.DEFAULT_STREAM_NAME)
);
}
diff --git a/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java b/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java
index dcb5c67b92..0bc08772ed 100644
--- a/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java
+++ b/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java
@@ -53,8 +53,8 @@ public final class TestBasic {
private static final POIDataSamples samples = POIDataSamples.getHPSFInstance();
private static final String[] POI_FILES = {
- "\005SummaryInformation",
- "\005DocumentSummaryInformation",
+ SummaryInformation.DEFAULT_STREAM_NAME,
+ DocumentSummaryInformation.DEFAULT_STREAM_NAME,
"WordDocument",
"\001CompObj",
"1Table"
diff --git a/src/testcases/org/apache/poi/hpsf/basic/TestEmptyProperties.java b/src/testcases/org/apache/poi/hpsf/basic/TestEmptyProperties.java
index 4e9eec6271..92e82d32e0 100644
--- a/src/testcases/org/apache/poi/hpsf/basic/TestEmptyProperties.java
+++ b/src/testcases/org/apache/poi/hpsf/basic/TestEmptyProperties.java
@@ -56,7 +56,7 @@ public final class TestEmptyProperties {
private static final String[] POI_FILES = {
"PerfectOffice_MAIN",
- "\005SummaryInformation",
+ SummaryInformation.DEFAULT_STREAM_NAME,
"Main"
};
diff --git a/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java b/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java
index 69e4367bbf..3e3eafd495 100644
--- a/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java
+++ b/src/testcases/org/apache/poi/hpsf/basic/TestUnicode.java
@@ -43,7 +43,7 @@ public class TestUnicode {
static final String POI_FS = "TestUnicode.xls";
static final String[] POI_FILES = {
- "\005DocumentSummaryInformation",
+ DocumentSummaryInformation.DEFAULT_STREAM_NAME,
};
File data;
POIFile[] poiFiles;
diff --git a/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java b/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java
index d740a8a37e..c87bf45e67 100644
--- a/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java
+++ b/src/testcases/org/apache/poi/hssf/dev/BaseXLSIteratingTest.java
@@ -90,9 +90,6 @@ public abstract class BaseXLSIteratingTest {
@Test
public void testMain() throws Exception {
- // we had intermittent problems when this was set differently somehow, let's try to set it here so it always is set correctly for these tests
- Biff8EncryptionKey.setCurrentUserPassword(null);
-
String fileName = file.getName();
if (EXCLUDED.containsKey(fileName)) {
thrown.expect(EXCLUDED.get(fileName));
diff --git a/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java b/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
index bf66cecef4..459cfe90ec 100644
--- a/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
+++ b/src/testcases/org/apache/poi/hssf/eventusermodel/TestHSSFEventFactory.java
@@ -46,12 +46,6 @@ public final class TestHSSFEventFactory extends TestCase {
return HSSFTestDataSamples.openSampleFileStream(sampleFileName);
}
- // to not affect other tests running in the same JVM
- @After
- public void resetPassword() {
- Biff8EncryptionKey.setCurrentUserPassword(null);
- }
-
public void testWithMissingRecords() throws Exception {
HSSFRequest req = new HSSFRequest();
@@ -156,7 +150,6 @@ public final class TestHSSFEventFactory extends TestCase {
req.addListenerForAllRecords(mockListen);
// Without a password, can't be read
- Biff8EncryptionKey.setCurrentUserPassword(null);
POIFSFileSystem fs = new POIFSFileSystem(openSample("xor-encryption-abc.xls"));
HSSFEventFactory factory = new HSSFEventFactory();
@@ -168,44 +161,47 @@ public final class TestHSSFEventFactory extends TestCase {
// With the password, is properly processed
Biff8EncryptionKey.setCurrentUserPassword("abc");
+ try {
+ req = new HSSFRequest();
+ mockListen = new MockHSSFListener();
+ req.addListenerForAllRecords(mockListen);
+ factory.processWorkbookEvents(req, fs);
- req = new HSSFRequest();
- mockListen = new MockHSSFListener();
- req.addListenerForAllRecords(mockListen);
- factory.processWorkbookEvents(req, fs);
-
- // Check we got the sheet and the contents
- Record[] recs = mockListen.getRecords();
- assertTrue( recs.length > 50 );
-
- // Has one sheet, with values 1,2,3 in column A rows 1-3
- boolean hasSheet=false, hasA1=false, hasA2=false, hasA3=false;
- for (Record r : recs) {
- if (r instanceof BoundSheetRecord) {
- BoundSheetRecord bsr = (BoundSheetRecord)r;
- assertEquals("Sheet1", bsr.getSheetname());
- hasSheet = true;
- }
- if (r instanceof NumberRecord) {
- NumberRecord nr = (NumberRecord)r;
- if (nr.getColumn() == 0 && nr.getRow() == 0) {
- assertEquals(1, (int)nr.getValue());
- hasA1 = true;
+ // Check we got the sheet and the contents
+ Record[] recs = mockListen.getRecords();
+ assertTrue(recs.length > 50);
+
+ // Has one sheet, with values 1,2,3 in column A rows 1-3
+ boolean hasSheet = false, hasA1 = false, hasA2 = false, hasA3 = false;
+ for (Record r : recs) {
+ if (r instanceof BoundSheetRecord) {
+ BoundSheetRecord bsr = (BoundSheetRecord) r;
+ assertEquals("Sheet1", bsr.getSheetname());
+ hasSheet = true;
}
- if (nr.getColumn() == 0 && nr.getRow() == 1) {
- assertEquals(2, (int)nr.getValue());
- hasA2 = true;
- }
- if (nr.getColumn() == 0 && nr.getRow() == 2) {
- assertEquals(3, (int)nr.getValue());
- hasA3 = true;
+ if (r instanceof NumberRecord) {
+ NumberRecord nr = (NumberRecord) r;
+ if (nr.getColumn() == 0 && nr.getRow() == 0) {
+ assertEquals(1, (int) nr.getValue());
+ hasA1 = true;
+ }
+ if (nr.getColumn() == 0 && nr.getRow() == 1) {
+ assertEquals(2, (int) nr.getValue());
+ hasA2 = true;
+ }
+ if (nr.getColumn() == 0 && nr.getRow() == 2) {
+ assertEquals(3, (int) nr.getValue());
+ hasA3 = true;
+ }
}
}
- }
- assertTrue("Sheet record not found", hasSheet);
- assertTrue("Numeric record for A1 not found", hasA1);
- assertTrue("Numeric record for A2 not found", hasA2);
- assertTrue("Numeric record for A3 not found", hasA3);
+ assertTrue("Sheet record not found", hasSheet);
+ assertTrue("Numeric record for A1 not found", hasA1);
+ assertTrue("Numeric record for A2 not found", hasA2);
+ assertTrue("Numeric record for A3 not found", hasA3);
+ } finally {
+ Biff8EncryptionKey.setCurrentUserPassword(null);
+ }
}
}
diff --git a/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java b/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
index faebefb848..fd9c49dc12 100644
--- a/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
+++ b/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
@@ -41,12 +41,6 @@ import org.junit.Test;
*
*/
public final class TestExcelExtractor {
- // to not affect other tests running in the same JVM
- @After
- public void resetPassword() {
- Biff8EncryptionKey.setCurrentUserPassword(null);
- }
-
private static ExcelExtractor createExtractor(String sampleFileName) throws IOException {
File file = HSSFTestDataSamples.getSampleFile(sampleFileName);
POIFSFileSystem fs = new POIFSFileSystem(file);
@@ -355,9 +349,10 @@ public final class TestExcelExtractor {
Biff8EncryptionKey.setCurrentUserPassword("password");
try (ExcelExtractor extractor = createExtractor("password.xls")) {
String text = extractor.getText();
+ assertContains(text, "ZIP");
+ } finally {
Biff8EncryptionKey.setCurrentUserPassword(null);
- assertContains(text, "ZIP");
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java b/src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
index 4cfdfcf242..a716717ad9 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
@@ -36,12 +36,6 @@ import org.junit.rules.ExpectedException;
* @author Josh Micich
*/
public final class TestRecordFactoryInputStream {
- // to not affect other tests running in the same JVM
- @After
- public void resetPassword() {
- Biff8EncryptionKey.setCurrentUserPassword(null);
- }
-
/**
* Hex dump of a BOF record and most of a FILEPASS record.
* A 16 byte saltHash should be added to complete the second record
@@ -82,7 +76,6 @@ public final class TestRecordFactoryInputStream {
+ SAMPLE_WINDOW1_ENCR1
);
- Biff8EncryptionKey.setCurrentUserPassword(null);
expectedEx.expect(EncryptedDocumentException.class);
expectedEx.expectMessage("Default password is invalid for salt/verifier/verifierHash");
createRFIS(dataWrongDefault);
@@ -100,7 +93,6 @@ public final class TestRecordFactoryInputStream {
+ SAMPLE_WINDOW1_ENCR1
);
- Biff8EncryptionKey.setCurrentUserPassword(null);
RecordFactoryInputStream rfis = createRFIS(dataCorrectDefault);
confirmReadInitialRecords(rfis);
}
@@ -121,12 +113,15 @@ public final class TestRecordFactoryInputStream {
+ SAMPLE_WINDOW1_ENCR2
);
+ expectedEx.expect(EncryptedDocumentException.class);
+ expectedEx.expectMessage("Supplied password is invalid for salt/verifier/verifierHash");
Biff8EncryptionKey.setCurrentUserPassword("passw0rd");
-
- expectedEx.expect(EncryptedDocumentException.class);
- expectedEx.expectMessage("Supplied password is invalid for salt/verifier/verifierHash");
- createRFIS(dataWrongDefault);
+ try {
+ createRFIS(dataWrongDefault);
+ } finally {
+ Biff8EncryptionKey.setCurrentUserPassword(null);
+ }
}
@Test
@@ -135,18 +130,19 @@ public final class TestRecordFactoryInputStream {
final String SAMPLE_WINDOW1_ENCR2 = "3D 00 12 00"
+ "45, B9, 90, FE, B6, C6, EC, 73, EE, 3F, 52, 45, 97, DB, E3, C1, D6, FE";
- Biff8EncryptionKey.setCurrentUserPassword("passw0rd");
-
byte[] dataCorrectDefault = HexRead.readFromString(""
+ COMMON_HEX_DATA
+ "C728659A C38E35E0 568A338F C3FC9D70" // correct saltHash for supplied password (and docId/saltHash)
+ SAMPLE_WINDOW1_ENCR2
);
- RecordFactoryInputStream rfis = createRFIS(dataCorrectDefault);
- Biff8EncryptionKey.setCurrentUserPassword(null);
-
- confirmReadInitialRecords(rfis);
+ Biff8EncryptionKey.setCurrentUserPassword("passw0rd");
+ try {
+ RecordFactoryInputStream rfis = createRFIS(dataCorrectDefault);
+ confirmReadInitialRecords(rfis);
+ } finally {
+ Biff8EncryptionKey.setCurrentUserPassword(null);
+ }
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
index 2f620eac95..53802f5069 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
@@ -102,12 +102,6 @@ import org.junit.Test;
* define the test in the base class {@link BaseTestBugzillaIssues}</b>
*/
public final class TestBugs extends BaseTestBugzillaIssues {
- // to not affect other tests running in the same JVM
- @After
- public void resetPassword() {
- Biff8EncryptionKey.setCurrentUserPassword(null);
- }
-
public TestBugs() {
super(HSSFITestDataProvider.instance);
}
@@ -2207,8 +2201,6 @@ public final class TestBugs extends BaseTestBugzillaIssues {
*/
@Test
public void bug50833() throws Exception {
- Biff8EncryptionKey.setCurrentUserPassword(null);
-
HSSFWorkbook wb1 = openSample("50833.xls");
HSSFSheet s = wb1.getSheetAt(0);
assertEquals("Sheet1", s.getSheetName());
@@ -2602,8 +2594,8 @@ public final class TestBugs extends BaseTestBugzillaIssues {
@Test(expected = EncryptedDocumentException.class)
public void bug35897() throws Exception {
// password is abc
+ Biff8EncryptionKey.setCurrentUserPassword("abc");
try {
- Biff8EncryptionKey.setCurrentUserPassword("abc");
openSample("xor-encryption-abc.xls").close();
} finally {
Biff8EncryptionKey.setCurrentUserPassword(null);
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestCryptoAPI.java b/src/testcases/org/apache/poi/hssf/usermodel/TestCryptoAPI.java
index 3baafa8b39..92e5f64472 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestCryptoAPI.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestCryptoAPI.java
@@ -30,11 +30,6 @@ import org.junit.Test;
public class TestCryptoAPI {
final HSSFITestDataProvider ssTests = HSSFITestDataProvider.instance;
- @AfterClass
- public static void resetPW() {
- Biff8EncryptionKey.setCurrentUserPassword(null);
- }
-
@Test
public void bug59857() throws IOException {
// XOR-Obfuscation
@@ -52,19 +47,17 @@ public class TestCryptoAPI {
private void validateContent(String wbFile, String password, String textExpected) throws IOException {
Biff8EncryptionKey.setCurrentUserPassword(password);
- HSSFWorkbook wb = ssTests.openSampleWorkbook(wbFile);
- ExcelExtractor ee1 = new ExcelExtractor(wb);
- String textActual = ee1.getText();
- assertContains(textActual, textExpected);
-
- Biff8EncryptionKey.setCurrentUserPassword("bla");
- HSSFWorkbook wbBla = ssTests.writeOutAndReadBack(wb);
- ExcelExtractor ee2 = new ExcelExtractor(wbBla);
- textActual = ee2.getText();
- assertContains(textActual, textExpected);
- ee2.close();
- ee1.close();
- wbBla.close();
- wb.close();
+ try (HSSFWorkbook wb = ssTests.openSampleWorkbook(wbFile);
+ ExcelExtractor ee1 = new ExcelExtractor(wb)
+ ) {
+ Biff8EncryptionKey.setCurrentUserPassword("bla");
+ try (HSSFWorkbook wbBla = ssTests.writeOutAndReadBack(wb);
+ ExcelExtractor ee2 = new ExcelExtractor(wbBla)) {
+ assertContains(ee1.getText(), textExpected);
+ assertContains(ee2.getText(), textExpected);
+ }
+ } finally {
+ Biff8EncryptionKey.setCurrentUserPassword(null);
+ }
}
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestNonStandardWorkbookStreamNames.java b/src/testcases/org/apache/poi/hssf/usermodel/TestNonStandardWorkbookStreamNames.java
index 0a84947b4c..80c0750c42 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestNonStandardWorkbookStreamNames.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestNonStandardWorkbookStreamNames.java
@@ -23,8 +23,12 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.InputStream;
+import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
import org.apache.poi.poifs.filesystem.DirectoryNode;
+import org.apache.poi.poifs.filesystem.Entry;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -49,7 +53,7 @@ public final class TestNonStandardWorkbookStreamNames {
// Ensure that we have a WORKBOOK entry and a summary
assertTrue(root.hasEntry("WORKBOOK"));
- assertTrue(root.hasEntry("\005SummaryInformation"));
+ assertTrue(root.hasEntry(SummaryInformation.DEFAULT_STREAM_NAME));
// But not a Workbook one
assertFalse(root.hasEntry("Workbook"));
@@ -73,7 +77,7 @@ public final class TestNonStandardWorkbookStreamNames {
// But not a Workbook one and not a Summary one
assertFalse(root.hasEntry("Workbook"));
- assertFalse(root.hasEntry("\\005SummaryInformation"));
+ assertFalse(root.hasEntry(SummaryInformation.DEFAULT_STREAM_NAME));
wb.close();
}
@@ -127,7 +131,7 @@ public final class TestNonStandardWorkbookStreamNames {
assertFalse(root.hasEntry("WORKBOOK"));
// As we preserved, should also have a few other streams
- assertTrue(root.hasEntry("\005SummaryInformation"));
+ assertTrue(root.hasEntry(SummaryInformation.DEFAULT_STREAM_NAME));
wb2.close();
}
}
diff --git a/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java b/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java
index 20dec4552f..002318b0eb 100644
--- a/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java
+++ b/src/testcases/org/apache/poi/poifs/crypt/TestXorEncryption.java
@@ -21,6 +21,7 @@ import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
+import java.io.File;
import java.io.IOException;
import org.apache.poi.hssf.HSSFTestDataSamples;
@@ -36,12 +37,6 @@ public class TestXorEncryption {
private static final HSSFTestDataSamples samples = new HSSFTestDataSamples();
- // to not affect other tests running in the same JVM
- @After
- public void resetPassword() {
- Biff8EncryptionKey.setCurrentUserPassword(null);
- }
-
@Test
public void testXorEncryption() throws IOException {
// Xor-Password: abc
@@ -61,15 +56,16 @@ public class TestXorEncryption {
@SuppressWarnings("static-access")
@Test
public void testUserFile() throws IOException {
+ File f = samples.getSampleFile("xor-encryption-abc.xls");
Biff8EncryptionKey.setCurrentUserPassword("abc");
- NPOIFSFileSystem fs = new NPOIFSFileSystem(samples.getSampleFile("xor-encryption-abc.xls"), true);
- HSSFWorkbook hwb = new HSSFWorkbook(fs.getRoot(), true);
-
- HSSFSheet sh = hwb.getSheetAt(0);
- assertEquals(1.0, sh.getRow(0).getCell(0).getNumericCellValue(), 0.0);
- assertEquals(2.0, sh.getRow(1).getCell(0).getNumericCellValue(), 0.0);
- assertEquals(3.0, sh.getRow(2).getCell(0).getNumericCellValue(), 0.0);
- hwb.close();
- fs.close();
+ try (NPOIFSFileSystem fs = new NPOIFSFileSystem(f, true);
+ HSSFWorkbook hwb = new HSSFWorkbook(fs.getRoot(), true)) {
+ HSSFSheet sh = hwb.getSheetAt(0);
+ assertEquals(1.0, sh.getRow(0).getCell(0).getNumericCellValue(), 0.0);
+ assertEquals(2.0, sh.getRow(1).getCell(0).getNumericCellValue(), 0.0);
+ assertEquals(3.0, sh.getRow(2).getCell(0).getNumericCellValue(), 0.0);
+ } finally {
+ Biff8EncryptionKey.setCurrentUserPassword(null);
+ }
}
}
diff --git a/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java b/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java
index bd0b30edde..d4442e859a 100644
--- a/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java
+++ b/src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java
@@ -20,6 +20,8 @@ package org.apache.poi.poifs.property;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import org.apache.poi.hpsf.DocumentSummaryInformation;
+import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.poifs.storage.RawDataUtil;
import org.apache.poi.util.LocaleUtil;
@@ -68,8 +70,8 @@ public final class TestDocumentProperty extends TestCase {
byte[] input = RawDataUtil.decode(hexData);
verifyReadingProperty(1, input, 128, "Workbook");
- verifyReadingProperty(2, input, 256, "\005SummaryInformation");
- verifyReadingProperty(3, input, 384, "\005DocumentSummaryInformation");
+ verifyReadingProperty(2, input, 256, SummaryInformation.DEFAULT_STREAM_NAME);
+ verifyReadingProperty(3, input, 384, DocumentSummaryInformation.DEFAULT_STREAM_NAME);
}
private void verifyReadingProperty(int index, byte[] input, int offset, String name)
diff --git a/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java b/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
index 3950ce07e2..74cc83f879 100644
--- a/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
+++ b/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
@@ -25,6 +25,8 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import org.apache.poi.hpsf.DocumentSummaryInformation;
+import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.poifs.storage.BlockAllocationTableReader;
import org.apache.poi.poifs.storage.HeaderBlock;
@@ -79,11 +81,10 @@ public final class TestPropertyTable {
DocumentProperty workbook = new DocumentProperty("Workbook", 0x00046777);
workbook.setStartBlock(0);
- DocumentProperty summary1 = new DocumentProperty("\005SummaryInformation", 0x00001000);
+ DocumentProperty summary1 = new DocumentProperty(SummaryInformation.DEFAULT_STREAM_NAME, 0x00001000);
summary1.setStartBlock(0x00000234);
- DocumentProperty summary2 = new DocumentProperty("\005DocumentSummaryInformation",
- 0x00001000);
+ DocumentProperty summary2 = new DocumentProperty(DocumentSummaryInformation.DEFAULT_STREAM_NAME, 0x00001000);
summary2.setStartBlock(0x0000023C);
table.addProperty(workbook);