From: Andreas Beeker Date: Wed, 25 Dec 2013 23:24:04 +0000 (+0000) Subject: javadoc and compiler warning house-keeping X-Git-Tag: REL_3_10_FINAL~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8372eb89ecc27fa75d7a031c5f61afa99e9e58e4;p=poi.git javadoc and compiler warning house-keeping git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1553428 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java index 4b2ffb2b4e..589821ea0c 100644 --- a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java +++ b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java @@ -27,26 +27,27 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.math.BigInteger; import java.security.GeneralSecurityException; import java.security.KeyPair; -import java.security.KeyPairGenerator; import java.security.KeyStore; import java.security.PrivateKey; import java.security.PublicKey; -import java.security.SecureRandom; -import java.security.cert.Certificate; import java.security.cert.X509Certificate; -import java.util.Date; import org.apache.poi.POIDataSamples; import org.apache.poi.poifs.crypt.agile.AgileDecryptor; import org.apache.poi.poifs.crypt.agile.AgileEncryptionVerifier; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.util.IOUtils; -import org.junit.BeforeClass; import org.junit.Test; +/* +import org.junit.BeforeClass; +import java.util.Date; +import java.math.BigInteger; +import java.security.KeyPairGenerator; +import java.security.SecureRandom; +import java.security.cert.Certificate; import sun.security.x509.AlgorithmId; import sun.security.x509.CertificateAlgorithmId; import sun.security.x509.CertificateIssuerName; @@ -58,9 +59,10 @@ import sun.security.x509.CertificateX509Key; import sun.security.x509.X500Name; import sun.security.x509.X509CertImpl; import sun.security.x509.X509CertInfo; +*/ /** - * {@linkplain http://stackoverflow.com/questions/1615871/creating-an-x509-certificate-in-java-without-bouncycastle} + * @see creating a self-signed certificate */ public class TestCertificateEncryption { /** @@ -91,7 +93,7 @@ public class TestCertificateEncryption { * The keystore generation / loading is split, because normally the keystore would * already exist. */ - @BeforeClass + /* @BeforeClass public static void initKeystore() throws GeneralSecurityException, IOException { CertData certData = new CertData(); @@ -134,14 +136,16 @@ public class TestCertificateEncryption { ByteArrayOutputStream bos = new ByteArrayOutputStream(); keystore.store(bos, password.toCharArray()); pfxFileBytes = bos.toByteArray(); - } + } */ public CertData loadKeystore() throws GeneralSecurityException, IOException { KeyStore keystore = KeyStore.getInstance("PKCS12"); - InputStream fis = new ByteArrayInputStream(pfxFileBytes); + // InputStream fis = new ByteArrayInputStream(pfxFileBytes); + InputStream fis = POIDataSamples.getPOIFSInstance().openResourceAsStream("poitest.pfx"); keystore.load(fis, password.toCharArray()); + fis.close(); X509Certificate x509 = (X509Certificate)keystore.getCertificate(certAlias); PrivateKey privateKey = (PrivateKey)keystore.getKey(certAlias, password.toCharArray()); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java b/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java index ab1076c458..27fd702100 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java @@ -21,8 +21,6 @@ import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.List; -import junit.framework.TestCase; - import org.apache.poi.POIDataSamples; import org.apache.poi.POITestCase; import org.apache.poi.hslf.HSLFSlideShow; @@ -57,10 +55,6 @@ public final class TestExtractor extends POITestCase { ppe2 = new PowerPointExtractor(slTests.openResourceAsStream("with_textbox.ppt")); } - private static void assertContains(String reason, String haystack, String needle) { - assertTrue(reason, haystack.contains(needle)); - } - public void testReadSheetText() { // Basic 2 page example String sheetText = ppe.getText(); @@ -174,6 +168,7 @@ public final class TestExtractor extends POITestCase { /** * A powerpoint file with embeded powerpoint files */ + @SuppressWarnings("unused") public void testExtractFromOwnEmbeded() throws Exception { String path = "ppt_with_embeded.ppt"; ppe = new PowerPointExtractor(POIDataSamples.getSlideShowInstance().openResourceAsStream(path)); @@ -281,6 +276,7 @@ public final class TestExtractor extends POITestCase { assertContains(text, "test phrase"); } + @SuppressWarnings("unused") public void testSlideMasterText() throws Exception { String masterTitleText = "This is the Master Title"; String masterRandomText = "This text comes from the Master Slide"; @@ -337,10 +333,10 @@ public final class TestExtractor extends POITestCase { // Check for the english text in the mixed line assertContains(text, "Mix"); - // Check for the chinese text in the mixed line - 表 + // Check for the chinese text in the mixed line assertContains(text, "\u8868"); - // Check for the chinese only text line - ハンカク + // Check for the chinese only text line assertContains(text, "\uff8a\uff9d\uff76\uff78"); } @@ -348,6 +344,7 @@ public final class TestExtractor extends POITestCase { * Tests that we can work with both {@link POIFSFileSystem} * and {@link NPOIFSFileSystem} */ + @SuppressWarnings("resource") public void testDifferentPOIFS() throws Exception { // Open the two filesystems DirectoryNode[] files = new DirectoryNode[2]; @@ -356,7 +353,7 @@ public final class TestExtractor extends POITestCase { // Open directly for(DirectoryNode dir : files) { - PowerPointExtractor extractor = new PowerPointExtractor(dir, null); + PowerPointExtractor extractor = new PowerPointExtractor(dir); assertEquals(expectText, extractor.getText()); } diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java index fe013f491a..a71b72a28b 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java @@ -649,7 +649,7 @@ if(false) { // Check we can get the english text out of that String text = rt.getText(); assertContains(text, "Single byte"); - // And the chinese - ハンカク + // And the chinese assertContains(text, "\uff8a\uff9d\uff76\uff78"); // It isn't bold or italic diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java b/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java index 6e1963b69a..a934202ed1 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java @@ -19,8 +19,13 @@ package org.apache.poi.ss.formula.functions; import junit.framework.AssertionFailedError; import junit.framework.TestCase; + import org.apache.poi.hssf.HSSFTestDataSamples; -import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.usermodel.CellValue; @@ -29,7 +34,7 @@ import org.apache.poi.ss.usermodel.CellValue; * Tests for {@link org.apache.poi.ss.formula.functions.Mirr} * * @author Carlos Delgado (carlos dot del dot est at gmail dot com) - * @author Cédric Walter (cedric dot walter at gmail dot com) + * @author Cedric Walter (cedric dot walter at gmail dot com) * @see {@link org.apache.poi.ss.formula.functions.TestIrr} */ public final class TestMirr extends TestCase { diff --git a/test-data/poifs/poitest.pfx b/test-data/poifs/poitest.pfx new file mode 100644 index 0000000000..14be4d0a60 Binary files /dev/null and b/test-data/poifs/poitest.pfx differ