Fix encoding problems when parsing XML (patch 1320132)

This commit is contained in:
Oliver Burn 2005-10-19 12:44:44 +00:00
parent 253622ab83
commit 70f4568a3d
4 changed files with 18 additions and 16 deletions

View File

@ -18,16 +18,15 @@
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle;
import com.puppycrawl.tools.checkstyle.api.AbstractLoader;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Stack;
import javax.xml.parsers.ParserConfigurationException;
import com.puppycrawl.tools.checkstyle.api.AbstractLoader;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@ -157,15 +156,15 @@ public final class PackageNamesLoader
public static ModuleFactory loadModuleFactory(String aFilename)
throws CheckstyleException
{
FileReader reader = null;
FileInputStream fis = null;
try {
reader = new FileReader(aFilename);
fis = new FileInputStream(aFilename);
}
catch (FileNotFoundException e) {
throw new CheckstyleException(
"unable to find " + aFilename, e);
}
final InputSource source = new InputSource(reader);
final InputSource source = new InputSource(fis);
return loadModuleFactory(source, aFilename);
}

View File

@ -20,8 +20,8 @@ package com.puppycrawl.tools.checkstyle.checks.imports;
import com.puppycrawl.tools.checkstyle.api.AbstractLoader;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Stack;
import javax.xml.parsers.ParserConfigurationException;
@ -115,14 +115,14 @@ final class ImportControlLoader extends AbstractLoader
*/
static PkgControl load(final String aFilename) throws CheckstyleException
{
FileReader reader = null;
FileInputStream fis = null;
try {
reader = new FileReader(aFilename);
fis = new FileInputStream(aFilename);
}
catch (FileNotFoundException e) {
throw new CheckstyleException("unable to find " + aFilename, e);
}
final InputSource source = new InputSource(reader);
final InputSource source = new InputSource(fis);
return load(source, aFilename);
}

View File

@ -21,8 +21,8 @@ package com.puppycrawl.tools.checkstyle.filters;
import com.puppycrawl.tools.checkstyle.api.AbstractLoader;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.FilterSet;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.regex.PatternSyntaxException;
import javax.xml.parsers.ParserConfigurationException;
@ -116,15 +116,15 @@ public final class SuppressionsLoader
public static FilterSet loadSuppressions(String aFilename)
throws CheckstyleException
{
FileReader reader = null;
FileInputStream fis = null;
try {
reader = new FileReader(aFilename);
fis = new FileInputStream(aFilename);
}
catch (FileNotFoundException e) {
throw new CheckstyleException(
"unable to find " + aFilename, e);
}
final InputSource source = new InputSource(reader);
final InputSource source = new InputSource(fis);
return loadSuppressions(source, aFilename);
}

View File

@ -41,7 +41,10 @@
<p>Fixed Bugs:</p>
<ul>
<li>TBD</li>
<li>
Fixed encoding problems when parsing XML because was using
FileReader instead of FileInputStream. Bug 1320132.
</li>
</ul>
<p>Other improvements:</p>