fixes
This commit is contained in:
parent
3f7840c1df
commit
e81449db4a
@ -24,6 +24,7 @@ import net.sourceforge.pmd.lang.Language;
|
||||
import net.sourceforge.pmd.lang.LanguagePropertyBundle;
|
||||
import net.sourceforge.pmd.lang.ast.FileAnalysisException;
|
||||
import net.sourceforge.pmd.lang.ast.LexException;
|
||||
import net.sourceforge.pmd.lang.ast.impl.javacc.MalformedSourceException;
|
||||
import net.sourceforge.pmd.lang.document.FileCollector;
|
||||
import net.sourceforge.pmd.lang.document.FileId;
|
||||
import net.sourceforge.pmd.lang.document.InternalApiBridge;
|
||||
@ -171,7 +172,7 @@ public final class CpdAnalysis implements AutoCloseable {
|
||||
int newTokens = doTokenize(textDocument, tokenizers.get(textFile.getLanguageVersion().getLanguage()), tokens);
|
||||
numberOfTokensPerFile.put(textDocument.getFileId(), newTokens);
|
||||
listener.addedFile(1);
|
||||
} catch (LexException | IOException e) {
|
||||
} catch (LexException | IOException | MalformedSourceException e) {
|
||||
if (e instanceof FileAnalysisException) { // NOPMD
|
||||
((FileAnalysisException) e).setFileId(textFile.getFileId());
|
||||
}
|
||||
|
@ -68,6 +68,9 @@ abstract class BaseMappedDocument implements TextDocument {
|
||||
* @return Input region
|
||||
*/
|
||||
protected @NonNull TextRegion inputRegion(TextRegion outputRegion) {
|
||||
if (outputRegion.isEmpty()) {
|
||||
return TextRegion.caretAt(inputOffset(outputRegion.getStartOffset(), false));
|
||||
}
|
||||
return TextRegion.fromBothOffsets(inputOffset(outputRegion.getStartOffset(), true),
|
||||
inputOffset(outputRegion.getEndOffset(), false));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user