From affb0461c9ca39129571c046c1cf96010020a964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 17 Mar 2020 15:53:19 +0100 Subject: [PATCH] Skip bom --- .../src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java | 3 ++- .../src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java index c69632acfe..35326a3640 100644 --- a/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java +++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java @@ -9,12 +9,13 @@ import org.apache.commons.io.input.CharSequenceReader; import net.sourceforge.pmd.cpd.internal.JavaCCTokenizer; import net.sourceforge.pmd.lang.TokenManager; import net.sourceforge.pmd.lang.jsp.ast.JspTokenManager; +import net.sourceforge.pmd.util.IOUtil; public class JSPTokenizer extends JavaCCTokenizer { @Override protected TokenManager getLexerForSource(SourceCode sourceCode) { - return new JspTokenManager(new CharSequenceReader(sourceCode.getCodeBuffer())); + return new JspTokenManager(IOUtil.skipBOM(new CharSequenceReader(sourceCode.getCodeBuffer()))); } } diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java index 4423065888..21ab69cc53 100644 --- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java +++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java @@ -9,6 +9,7 @@ import org.apache.commons.io.input.CharSequenceReader; import net.sourceforge.pmd.cpd.internal.JavaCCTokenizer; import net.sourceforge.pmd.lang.TokenManager; import net.sourceforge.pmd.lang.vf.ast.VfTokenManager; +import net.sourceforge.pmd.util.IOUtil; /** * @author sergey.gorbaty @@ -17,6 +18,6 @@ public class VfTokenizer extends JavaCCTokenizer { @Override protected TokenManager getLexerForSource(SourceCode sourceCode) { - return new VfTokenManager(new CharSequenceReader(sourceCode.getCodeBuffer())); + return new VfTokenManager(IOUtil.skipBOM(new CharSequenceReader(sourceCode.getCodeBuffer()))); } }