From 0572a449c12dbffead21d99895f7321b4b31fa08 Mon Sep 17 00:00:00 2001 From: "Anna.Kozlova" Date: Tue, 20 Dec 2016 18:38:45 +0100 Subject: [PATCH] exception filter: check that module ref is before class fq name --- .../com/intellij/navigation/ExceptionFilterTest.java | 7 +++++++ .../com/intellij/execution/filters/ExceptionWorker.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/java/java-tests/testSrc/com/intellij/navigation/ExceptionFilterTest.java b/java/java-tests/testSrc/com/intellij/navigation/ExceptionFilterTest.java index 4072ef36b250..f36ca662ab99 100644 --- a/java/java-tests/testSrc/com/intellij/navigation/ExceptionFilterTest.java +++ b/java/java-tests/testSrc/com/intellij/navigation/ExceptionFilterTest.java @@ -35,4 +35,11 @@ public class ExceptionFilterTest extends JavaCodeInsightFixtureTestCase { assertNotNull(aClass); assertEquals(psiClass, aClass); } + + public void testNonClassInTheLine() throws Exception { + ExceptionWorker worker = new ExceptionWorker(new ExceptionInfoCache(GlobalSearchScope.allScope(getProject()))); + String line = "2016-12-20 10:58:36,617 [ 5740] INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: Android Support (10.2.2), Ant Support (1.0), Application Servers View (0.2.0), AspectJ Support (1.2), CFML Support (3.53), CSS Support (163.7743.44), CVS Integration (11), Cloud Foundry integration (1.0), CloudBees integration (1.0), Copyright (8.1), Coverage (163.7743.44), DSM Analysis (1.0.0), Database Tools and SQL (1.0), Eclipse Integration (3.0), EditorConfig (163.7743.44), Emma (163.7743.44), Flash/Flex Support (163.7743.44)"; + worker.execute(line, line.length()); + assertNull(worker.getPsiClass()); + } } \ No newline at end of file diff --git a/java/openapi/src/com/intellij/execution/filters/ExceptionWorker.java b/java/openapi/src/com/intellij/execution/filters/ExceptionWorker.java index 2928b0a5fb1a..10e36138fee5 100644 --- a/java/openapi/src/com/intellij/execution/filters/ExceptionWorker.java +++ b/java/openapi/src/com/intellij/execution/filters/ExceptionWorker.java @@ -201,7 +201,7 @@ public class ExceptionWorker { final int dotIdx = line.lastIndexOf('.', lParenIdx); if (dotIdx < 0 || dotIdx < startIdx) return null; int moduleIdx = line.indexOf('/'); - int classNameIdx = moduleIdx > -1 && moduleIdx < lParenIdx ? moduleIdx + 1 : startIdx + 1 + (startIdx >= 0 ? AT.length() : 0); + int classNameIdx = moduleIdx > -1 && moduleIdx < lParenIdx && moduleIdx < dotIdx ? moduleIdx + 1 : startIdx + 1 + (startIdx >= 0 ? AT.length() : 0); // class, method, link return Trinity.create(new TextRange(classNameIdx, handleSpaces(line, dotIdx, -1)),