poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fannin...@apache.org
Subject svn commit: r1818629 - in /poi/trunk/src: java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
Date Tue, 19 Dec 2017 00:33:16 GMT
Author: fanningpj
Date: Tue Dec 19 00:33:16 2017
New Revision: 1818629

URL: http://svn.apache.org/viewvc?rev=1818629&view=rev
Log:
use StandardCharsets

Modified:
    poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
    poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java?rev=1818629&r1=1818628&r2=1818629&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/function/FunctionMetadataReader.java Tue
Dec 19 00:33:16 2017
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
@@ -64,14 +65,7 @@ final class FunctionMetadataReader {
     		}
     
     		try {
-        		BufferedReader br;
-        		try {
-        			br = new BufferedReader(new InputStreamReader(is,"UTF-8"));
-        		} catch(UnsupportedEncodingException e) {
-        			throw new RuntimeException(e);
-        		}
-        		
-        		try {
+        		try(BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)))
{
         		    FunctionDataBuilder fdb = new FunctionDataBuilder(400);
         
         			while (true) {
@@ -90,8 +84,6 @@ final class FunctionMetadataReader {
         			}
 
         			return fdb.build();
-        		} finally {
-        		    br.close();
         		}
     		} finally {
     		    is.close();

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java?rev=1818629&r1=1818628&r2=1818629&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java Tue Dec 19 00:33:16
2017
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -394,8 +395,8 @@ public class SXSSFWorkbook implements Wo
     }
 
     private static void copyStreamAndInjectWorksheet(InputStream in, OutputStream out, InputStream
worksheetData) throws IOException {
-        InputStreamReader inReader=new InputStreamReader(in,"UTF-8");
-        OutputStreamWriter outWriter=new OutputStreamWriter(out,"UTF-8");
+        InputStreamReader inReader = new InputStreamReader(in, StandardCharsets.UTF_8);
+        OutputStreamWriter outWriter = new OutputStreamWriter(out, StandardCharsets.UTF_8);
         boolean needsStartTag = true;
         int c;
         int pos=0;

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java?rev=1818629&r1=1818628&r2=1818629&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java Tue Dec
19 00:33:16 2017
@@ -345,7 +345,7 @@ public final class TestOldExcelExtractor
             } finally {
                 out.close();
             }
-            String string = new String(out.toByteArray(), "UTF-8");
+            String string = out.toString("UTF-8");
             assertTrue("Had: " + string,
                     string.contains("Table C-13--Lemons"));
         } finally {



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


Mime
View raw message