javadoc and compiler warning house-keeping

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1553428 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2013-12-25 23:24:04 +00:00
parent 3ccd728544
commit 2788aca235
5 changed files with 28 additions and 22 deletions

View File

@ -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 <a href="http://stackoverflow.com/questions/1615871/creating-an-x509-certificate-in-java-without-bouncycastle">creating a self-signed certificate</a>
*/
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());

View File

@ -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());
}

View File

@ -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

View File

@ -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 {

BIN
test-data/poifs/poitest.pfx Normal file

Binary file not shown.