[console filters] IDEA-149878 Freeze in GradleConsoleFilterProvider: use a bombed char sequence with 1 sec delay

This commit is contained in:
Sergey Ignatov
2016-01-21 10:38:11 +03:00
parent 3ba6799a84
commit 6880af7516
2 changed files with 7 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ package com.intellij.execution.filters;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
@@ -61,6 +62,9 @@ public class CompositeFilter implements Filter, FilterMixin {
try {
result = filter.applyFilter(line, entireLength);
}
catch (ProcessCanceledException ignore) {
result = null;
}
catch (Throwable t) {
throw new RuntimeException("Error while applying " + filter + " to '" + line + "'", t);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -139,7 +139,7 @@ public class RegexpFilter implements Filter {
@Override
public Result applyFilter(String line, int entireLength) {
Matcher matcher = myPattern.matcher(line);
Matcher matcher = myPattern.matcher(StringUtil.newBombedCharSequence(line, 1000));
if (!matcher.find()) {
return null;
}