You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/12/31 21:37:14 UTC

svn commit: r1776817 - in /poi/trunk/src/ooxml: java/org/apache/poi/dev/OOXMLLister.java testcases/org/apache/poi/dev/TestOOXMLLister.java

Author: kiwiwings
Date: Sat Dec 31 21:37:14 2016
New Revision: 1776817

URL: http://svn.apache.org/viewvc?rev=1776817&view=rev
Log:
fix forbidden-apis-check error

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/dev/TestOOXMLLister.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java?rev=1776817&r1=1776816&r2=1776817&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java Sat Dec 31 21:37:14 2016
@@ -122,7 +122,7 @@ public class OOXMLLister implements Clos
 		container.close();
 	}
 
-	public static void main(String[] args) throws Exception {
+	public static void main(String[] args) throws IOException, InvalidFormatException {
 		if(args.length == 0) {
 			System.err.println("Use:");
 			System.err.println("\tjava OOXMLLister <filename>");

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/dev/TestOOXMLLister.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/dev/TestOOXMLLister.java?rev=1776817&r1=1776816&r2=1776817&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/dev/TestOOXMLLister.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/dev/TestOOXMLLister.java Sat Dec 31 21:37:14 2016
@@ -20,28 +20,34 @@
 ==================================================================== */
 package org.apache.poi.dev;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.util.NullOutputStream;
 import org.apache.poi.xssf.XSSFTestDataSamples;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.PrintStream;
-
 public class TestOOXMLLister {
     @Test
-    public void testMain() throws Exception {
+    public void testMain() throws IOException, InvalidFormatException {
         File file = XSSFTestDataSamples.getSampleFile("Formatting.xlsx");
         OOXMLLister.main(new String[] {file.getAbsolutePath()});
     }
 
     @Test
-    public void testWithPrintStream() throws Exception {
+    public void testWithPrintStream() throws IOException, InvalidFormatException {
         File file = XSSFTestDataSamples.getSampleFile("Formatting.xlsx");
-        OOXMLLister lister = new OOXMLLister(OPCPackage.open(file.getAbsolutePath(), PackageAccess.READ), new PrintStream(new NullOutputStream()));
+        PrintStream nullStream = new PrintStream(new NullOutputStream(), true, "UTF-8");
+        OPCPackage opc = OPCPackage.open(file.getAbsolutePath(), PackageAccess.READ);
+        OOXMLLister lister = new OOXMLLister(opc, nullStream);
         lister.displayParts();
         lister.displayRelations();
         lister.close();
+        opc.close();
+        nullStream.close();
     }
 }



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