curcuru 2002/09/04 08:59:45
Modified: test/java/src/org/apache/qetest/trax ExamplesTest.java
SystemIdImpInclTest.java
Log:
Incorporate patches from [EMAIL PROTECTED] to allow tests to run on
various platforms with different default encodings; basically
when we read files, ensure we force the encoding to UTF-8
since we know the files should be in that anyways (instead of
allowing the platform default to take over)
Revision Changes Path
1.13 +8 -5
xml-xalan/test/java/src/org/apache/qetest/trax/ExamplesTest.java
Index: ExamplesTest.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/ExamplesTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ExamplesTest.java 13 Jul 2002 02:20:06 -0000 1.12
+++ ExamplesTest.java 4 Sep 2002 15:59:45 -0000 1.13
@@ -107,7 +107,8 @@
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileReader;
+// import java.io.FileReader; @DEM - changes for better encoding support
+import java.io.InputStreamReader; //@DEM
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
@@ -443,8 +444,9 @@
TransformerFactory tfactory = TransformerFactory.newInstance();
// Note that in this case the XML encoding can not be processed!
- reporter.logTraceMsg("new BufferedReader(new FileReader(" + xslID);
- Reader xslReader = new BufferedReader(new FileReader(xslID));
+ reporter.logTraceMsg("new BufferedReader(new InputStreamReader(new
FileInputStream(" + xslID);
+ Reader xslReader = new BufferedReader(new InputStreamReader(new
FileInputStream(xslID), "UTF-8")); //@DEM
+// Reader xslReader = new BufferedReader(new FileReader(xslID)); @DEM
StreamSource xslSource = new StreamSource(xslReader);
// Note that if we don't do this, relative URLs can not be resolved
correctly!
xslSource.setSystemId(QetestUtils.filenameToURL(xslID));
@@ -454,7 +456,8 @@
// Note that in this case the XML encoding can not be processed!
reporter.logTraceMsg("new BufferedReader(new FileReader(" +
sourceID);
- Reader xmlReader = new BufferedReader(new FileReader(sourceID));
+ Reader xmlReader = new BufferedReader(new InputStreamReader(new
FileInputStream(sourceID), "UTF-8")); //@DEM
+// Reader xmlReader = new BufferedReader(new FileReader(sourceID));
@DEM
StreamSource xmlSource = new StreamSource(xmlReader);
// Note that if we don't do this, relative URLs can not be resolved
correctly!
xmlSource.setSystemId(QetestUtils.filenameToURL(sourceID));
1.10 +20 -9
xml-xalan/test/java/src/org/apache/qetest/trax/SystemIdImpInclTest.java
Index: SystemIdImpInclTest.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/trax/SystemIdImpInclTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SystemIdImpInclTest.java 13 Jul 2002 02:20:06 -0000 1.9
+++ SystemIdImpInclTest.java 4 Sep 2002 15:59:45 -0000 1.10
@@ -88,7 +88,8 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileReader;
+// import java.io.FileReader; //@DEM - changes for better encoding
support
+import java.io.InputStreamReader; //@DEM
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -422,7 +423,8 @@
// Answer: write a custom test case that parses the stylesheet
// and builds it, but doesn't get imports/includes until later
// when we have setSystemId
- xslInpSrc = new InputSource(testFileInfo.inputName);
+ xslInpSrc = new InputSource(new InputStreamReader(new
FileInputStream(testFileInfo.inputName), "UTF-8")); //@DEM
+// xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName)); @DEM
xslSource = new SAXSource(xslInpSrc);
xmlSource = new StreamSource(new
FileInputStream(testFileInfo.xmlName));
@@ -433,7 +435,11 @@
"SAXSource(inpSrc(str)).systemId(level0:
one up)");
********************************/
// level1: same systemId as actual file
- xslInpSrc = new InputSource(testFileInfo.inputName);
+ // @DEM changes are to allow test to run on various
+ // platforms regardeless of encodings; force it to
+ // be UTF-8 since that's what's checked in
+ xslInpSrc = new InputSource(new InputStreamReader(new
FileInputStream(testFileInfo.inputName), "UTF-8")); //@DEM
+// xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName)); @DEM
xslSource = new SAXSource(xslInpSrc);
xmlSource = new StreamSource(new
FileInputStream(testFileInfo.xmlName));
@@ -452,7 +458,8 @@
// Answer: write a custom test case that parses the stylesheet
// and builds it, but doesn't get imports/includes until later
// when we have setSystemId
- xslInpSrc = new InputSource(testFileInfo.inputName);
+ xslInpSrc = new InputSource(new InputStreamReader(new
FileInputStream(testFileInfo.inputName), "UTF-8")); //@DEM
+// xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName)); @DEM
xslSource = new SAXSource(xslInpSrc);
xmlSource = new StreamSource(new
FileInputStream(testFileInfo.xmlName));
@@ -509,7 +516,8 @@
// Verify basic transforms with with various systemId
// and a SAXSource(InputSource(Reader))
// level0: one level up
- xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName));
+ xslInpSrc = new InputSource(new InputStreamReader(new
FileInputStream(testFileInfo.inputName), "UTF-8")); //@DEM
+// xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName)); @DEM
xslSource = new SAXSource(xslInpSrc);
xmlSource = new StreamSource(new
FileInputStream(testFileInfo.xmlName));
@@ -520,7 +528,8 @@
"SAXSource(inpSrc(charS)).systemId(level0: one up)");
// level1: same systemId as actual file
- xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName));
+ xslInpSrc = new InputSource(new InputStreamReader(new
FileInputStream(testFileInfo.inputName), "UTF-8")); //@DEM
+// xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName)); @DEM
xslSource = new SAXSource(xslInpSrc);
xmlSource = new StreamSource(new
FileInputStream(testFileInfo.xmlName));
@@ -531,7 +540,8 @@
"SAXSource(inpSrc(charS)).systemId(level1: same level)");
// level2: one level down
- xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName));
+ xslInpSrc = new InputSource(new InputStreamReader(new
FileInputStream(testFileInfo.inputName), "UTF-8")); //@DEM
+// xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName)); @DEM
xslSource = new SAXSource(xslInpSrc);
xmlSource = new StreamSource(new
FileInputStream(testFileInfo.xmlName));
@@ -549,7 +559,8 @@
SAXParser saxParser = spfactory.newSAXParser();
XMLReader reader = saxParser.getXMLReader();
// level0: one level up, with a character stream
- xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName));
+ xslInpSrc = new InputSource(new InputStreamReader(new
FileInputStream(testFileInfo.inputName), "UTF-8")); //@DEM
+// xslInpSrc = new InputSource(new
FileReader(testFileInfo.inputName)); @DEM
xslSource = new SAXSource(reader, xslInpSrc);
xmlSource = new StreamSource(new
FileInputStream(testFileInfo.xmlName));
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]