aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2019-12-05 00:18:36 +0000
committerAndreas Beeker <kiwiwings@apache.org>2019-12-05 00:18:36 +0000
commit9f2f9dc7937f66397f5fd157df4092ed40998f95 (patch)
treebc21deeb04621f172ab3b6fa4f096b73fc3fa1e3 /src/scratchpad
parent08159e66a738c291572745cee8cc3617777dc2b5 (diff)
downloadpoi-9f2f9dc7937f66397f5fd157df4092ed40998f95.tar.gz
poi-9f2f9dc7937f66397f5fd157df4092ed40998f95.zip
Sonar Fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1870856 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java12
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java6
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java10
3 files changed, 7 insertions, 21 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
index 3103c81869..b297ed4f1d 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
@@ -27,7 +27,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
@@ -83,7 +82,7 @@ public class WordToTextConverter extends AbstractWordConverter
/**
* Java main() interface to interact with {@link WordToTextConverter}
- *
+ *
* <p>
* Usage: WordToTextConverter infile outfile
* </p>
@@ -131,7 +130,7 @@ public class WordToTextConverter extends AbstractWordConverter
/**
* Creates new instance of {@link WordToTextConverter}. Can be used for
* output several {@link HWPFDocument}s into single text document.
- *
+ *
* @throws ParserConfigurationException
* if an internal {@link DocumentBuilder} cannot be created
*/
@@ -144,7 +143,7 @@ public class WordToTextConverter extends AbstractWordConverter
/**
* Creates new instance of {@link WordToTextConverter}. Can be used for
* output several {@link HWPFDocument}s into single text document.
- *
+ *
* @param document
* XML DOM Document used as storage for text pieces
*/
@@ -178,11 +177,8 @@ public class WordToTextConverter extends AbstractWordConverter
DOMSource domSource = new DOMSource( getDocument() );
StreamResult streamResult = new StreamResult( stringWriter );
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer serializer = tf.newTransformer();
+ Transformer serializer = XMLHelper.newTransformer();
// TODO set encoding from a command argument
- serializer.setOutputProperty( OutputKeys.ENCODING, "UTF-8" );
- serializer.setOutputProperty( OutputKeys.INDENT, "no" );
serializer.setOutputProperty( OutputKeys.METHOD, "text" );
serializer.transform( domSource, streamResult );
diff --git a/src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java b/src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java
index cdf362acc9..8b8d05cf57 100644
--- a/src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java
+++ b/src/scratchpad/testcases/org/apache/poi/hssf/converter/TestExcelConverterSuite.java
@@ -26,7 +26,6 @@ import java.util.List;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
@@ -106,10 +105,7 @@ public class TestExcelConverterSuite
StringWriter stringWriter = new StringWriter();
- Transformer transformer = TransformerFactory.newInstance()
- .newTransformer();
- transformer.setOutputProperty( OutputKeys.ENCODING, "utf-8" );
- transformer.setOutputProperty( OutputKeys.INDENT, "no" );
+ Transformer transformer = XMLHelper.newTransformer();
transformer.setOutputProperty( OutputKeys.METHOD, "html" );
transformer.transform(
new DOMSource( excelToHtmlConverter.getDocument() ),
diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java
index 1a8d5b8b80..ac0f30006b 100644
--- a/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java
+++ b/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java
@@ -26,7 +26,6 @@ import java.util.List;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
@@ -105,10 +104,7 @@ public class TestWordToConverterSuite
StringWriter stringWriter = new StringWriter();
- Transformer transformer = TransformerFactory.newInstance()
- .newTransformer();
- transformer.setOutputProperty( OutputKeys.ENCODING, "utf-8" );
- transformer.setOutputProperty( OutputKeys.INDENT, "false" );
+ Transformer transformer = XMLHelper.newTransformer();
transformer.setOutputProperty( OutputKeys.METHOD, "html" );
transformer.transform(
new DOMSource( wordToHtmlConverter.getDocument() ),
@@ -134,9 +130,7 @@ public class TestWordToConverterSuite
StringWriter stringWriter = new StringWriter();
- Transformer transformer = TransformerFactory.newInstance()
- .newTransformer();
- transformer.setOutputProperty( OutputKeys.ENCODING, "utf-8" );
+ Transformer transformer = XMLHelper.newTransformer();
transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
transformer.setOutputProperty( OutputKeys.METHOD, "text" );
transformer.transform(