exception filter: check that module ref is before class fq name

This commit is contained in:
Anna.Kozlova
2016-12-20 19:31:40 +01:00
parent 805bf52a8a
commit 0572a449c1
2 changed files with 8 additions and 1 deletions
@@ -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());
}
}
@@ -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)),