Replace IOUtils with IOUtil
plsql, xml, apex, html, javascript, scala
This commit is contained in:
@ -8,12 +8,11 @@ import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
import net.sourceforge.pmd.lang.apex.ApexJorjeLogging;
|
||||
import net.sourceforge.pmd.lang.apex.ApexParserOptions;
|
||||
import net.sourceforge.pmd.lang.ast.ParseException;
|
||||
import net.sourceforge.pmd.util.IOUtil;
|
||||
|
||||
import apex.jorje.data.Locations;
|
||||
import apex.jorje.semantic.ast.compilation.Compilation;
|
||||
@ -50,7 +49,7 @@ public class ApexParser {
|
||||
|
||||
public ApexNode<Compilation> parse(final Reader reader) {
|
||||
try {
|
||||
final String sourceCode = IOUtils.toString(reader);
|
||||
final String sourceCode = IOUtil.readToString(reader);
|
||||
final Compilation astRoot = parseApex(sourceCode);
|
||||
final ApexTreeBuilder treeBuilder = new ApexTreeBuilder(sourceCode, parserOptions);
|
||||
suppressMap = treeBuilder.getSuppressMap();
|
||||
|
@ -10,7 +10,6 @@ import java.io.Reader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.parser.Parser;
|
||||
|
||||
@ -18,6 +17,7 @@ import net.sourceforge.pmd.lang.ParserOptions;
|
||||
import net.sourceforge.pmd.lang.TokenManager;
|
||||
import net.sourceforge.pmd.lang.ast.Node;
|
||||
import net.sourceforge.pmd.lang.ast.ParseException;
|
||||
import net.sourceforge.pmd.util.IOUtil;
|
||||
|
||||
public final class HtmlParser implements net.sourceforge.pmd.lang.Parser {
|
||||
|
||||
@ -29,7 +29,7 @@ public final class HtmlParser implements net.sourceforge.pmd.lang.Parser {
|
||||
@Override
|
||||
public Node parse(String fileName, Reader source) throws ParseException {
|
||||
try {
|
||||
String data = IOUtils.toString(source);
|
||||
String data = IOUtil.readToString(source);
|
||||
Document doc = Parser.xmlParser().parseInput(data, "");
|
||||
HtmlTreeBuilder builder = new HtmlTreeBuilder();
|
||||
return builder.build(doc, data);
|
||||
|
@ -11,7 +11,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.mozilla.javascript.CompilerEnvirons;
|
||||
import org.mozilla.javascript.Parser;
|
||||
import org.mozilla.javascript.ast.AstRoot;
|
||||
@ -22,6 +21,7 @@ import org.mozilla.javascript.ast.ParseProblem;
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
import net.sourceforge.pmd.lang.ast.ParseException;
|
||||
import net.sourceforge.pmd.lang.ecmascript.EcmascriptParserOptions;
|
||||
import net.sourceforge.pmd.util.IOUtil;
|
||||
|
||||
public class EcmascriptParser {
|
||||
@Deprecated
|
||||
@ -64,7 +64,7 @@ public class EcmascriptParser {
|
||||
public EcmascriptNode<AstRoot> parse(final Reader reader) {
|
||||
try {
|
||||
final List<ParseProblem> parseProblems = new ArrayList<>();
|
||||
final String sourceCode = IOUtils.toString(reader);
|
||||
final String sourceCode = IOUtil.readToString(reader);
|
||||
final AstRoot astRoot = parseEcmascript(sourceCode, parseProblems);
|
||||
final EcmascriptTreeBuilder treeBuilder = new EcmascriptTreeBuilder(sourceCode, parseProblems);
|
||||
EcmascriptNode<AstRoot> tree = treeBuilder.build(astRoot);
|
||||
|
@ -10,8 +10,6 @@ import java.io.StringReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import net.sourceforge.pmd.annotation.InternalApi;
|
||||
import net.sourceforge.pmd.lang.AbstractParser;
|
||||
import net.sourceforge.pmd.lang.LanguageVersionHandler;
|
||||
@ -56,7 +54,7 @@ public class PLSQLParser extends AbstractParser {
|
||||
@Override
|
||||
public Node parse(String fileName, Reader source) throws ParseException {
|
||||
try {
|
||||
String sourcecode = IOUtils.toString(source);
|
||||
String sourcecode = IOUtil.readToString(source);
|
||||
AbstractTokenManager.setFileName(fileName);
|
||||
return createPLSQLParser(new StringReader(sourcecode)).Input(sourcecode);
|
||||
} catch (IOException e) {
|
||||
|
@ -9,13 +9,12 @@ import java.io.Reader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import net.sourceforge.pmd.lang.AbstractParser;
|
||||
import net.sourceforge.pmd.lang.ParserOptions;
|
||||
import net.sourceforge.pmd.lang.TokenManager;
|
||||
import net.sourceforge.pmd.lang.ast.ParseException;
|
||||
import net.sourceforge.pmd.lang.scala.ast.ASTSource;
|
||||
import net.sourceforge.pmd.util.IOUtil;
|
||||
|
||||
import scala.meta.Dialect;
|
||||
import scala.meta.Source;
|
||||
@ -52,7 +51,7 @@ public class ScalaParser extends AbstractParser {
|
||||
public ASTSource parse(String fileName, Reader source) throws ParseException {
|
||||
Input.VirtualFile virtualFile;
|
||||
try {
|
||||
String sourceString = IOUtils.toString(source);
|
||||
String sourceString = IOUtil.readToString(source);
|
||||
virtualFile = new Input.VirtualFile(fileName, sourceString);
|
||||
} catch (IOException e) {
|
||||
throw new ParseException(e);
|
||||
|
@ -13,7 +13,6 @@ import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
@ -22,6 +21,7 @@ import org.xml.sax.SAXException;
|
||||
import net.sourceforge.pmd.lang.ast.ParseException;
|
||||
import net.sourceforge.pmd.lang.ast.RootNode;
|
||||
import net.sourceforge.pmd.lang.xml.XmlParserOptions;
|
||||
import net.sourceforge.pmd.util.IOUtil;
|
||||
|
||||
|
||||
public class XmlParser {
|
||||
@ -37,7 +37,7 @@ public class XmlParser {
|
||||
protected Document parseDocument(Reader reader) throws ParseException {
|
||||
nodeCache.clear();
|
||||
try {
|
||||
String xmlData = IOUtils.toString(reader);
|
||||
String xmlData = IOUtil.readToString(reader);
|
||||
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
dbf.setNamespaceAware(parserOptions.isNamespaceAware());
|
||||
|
Reference in New Issue
Block a user