review comments

This commit is contained in:
Maxim.Mossienko
2017-07-04 17:15:49 +02:00
parent 572aab8466
commit 48c34329ae
3 changed files with 7 additions and 5 deletions
@@ -15,9 +15,9 @@
*/
package com.intellij.find;
import com.intellij.Patches;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.search.SearchScope;
import com.intellij.util.PatternUtil;
@@ -940,7 +940,11 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
if (pattern == PatternUtil.NOTHING) {
int flags = isCaseSensitive() ? Pattern.MULTILINE : Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
if (toFind.contains("\\n") && Patches.JDK_SOE_IN_REGEXP) { // if needed use DOT_ALL for modified pattern to avoid SOE
// SOE during matching regular expressions is considered to be feature
// http://bugs.java.com/view_bug.do?bug_id=6882582
// http://bugs.java.com/view_bug.do?bug_id=5050507
// IDEA-175066 / https://stackoverflow.com/questions/31676277/stackoverflowerror-in-regular-expression
if (toFind.contains("\\n") && Registry.is("jdk.regex.soe.workaround")) { // if needed use DOT_ALL for modified pattern to avoid SOE
String modifiedStringToFind = StringUtil.replace(toFind, "\\n|.", ".");
modifiedStringToFind = StringUtil.replace(modifiedStringToFind, ".|\\n", ".");
@@ -1165,3 +1165,4 @@ goto.action.skip.tophits.and.options.description=Skip top hits and options in go
dsm.show.cycle.count.in.tooltip=false
dsm.show.cycle.count.in.tooltip.description=Shows number of cycles found in the tooltip of the Toggle Cycles toolbar button after some calculation time
jdk.regex.soe.workaround=true
@@ -137,7 +137,4 @@ public class Patches {
public static final boolean JDK_BUG_ID_8032832 = SystemInfo.isJavaVersionAtLeast("1.8.0_20");
public static final boolean JDK_BUG_ID_8147994 = !SystemInfo.isMac && !SystemInfo.isJavaVersionAtLeast("1.8.0_102");
// IDEA-175066 / https://stackoverflow.com/questions/31676277/stackoverflowerror-in-regular-expression
public static final boolean JDK_SOE_IN_REGEXP = (true);
}