-
Bug
-
Resolution: Not an Issue
-
P3
-
5.0
-
b119
-
x86
-
windows_xp
FULL PRODUCT VERSION :
Fedora:
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
Windows:
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
2.6.12-1.1378_FC3smp #1 SMP Wed Sep 14 04:52:36 EDT 2005 i686 i686 i386 GNU/Linux Fedora Core release 3 (Heidelberg)
and
Microsoft Windows XP Professional Version 2002 Service Pack 2
Pentium(R) 4 CPU 2.80GHz
1GB of RAM
A DESCRIPTION OF THE PROBLEM :
((<[^>]+>)?(((\\s)?)*(\\ )?)*((\\s)?)*)+ pattern causes the matcher to utilize 100% of the CPU when matching against the following pattern:
" < br/> < / p> <p> <html> <adfasfdasdf> p </p>"
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See test case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
GOOD is the expected result.
ACTUAL -
Utilizes 100% of CPU
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegExp
{
public static void main(String[] args)
{
String[] exps = new String[] {
//"<asdfasdf><x>"
//"<p> "
" < br/> < / p> <p> <html> <adfasfdasdf> p </p>"
//" <xx> <adfasfdasdf> p </p>"
};
for (int i = 0; i < exps.length; i++)
{
Pattern p = Pattern.compile("((<[^>]+>)?(((\\s)?)*(\\ )?)*((\\s)?)*)+");
Matcher m = p.matcher(exps[i]);
if (m.matches())
{
System.out.println("replace["+m.replaceAll("REPLACED")+"]");
}
else
{
System.out.println("GOOD");
}
}
}
}
---------- END SOURCE ----------
Fedora:
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
Windows:
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
2.6.12-1.1378_FC3smp #1 SMP Wed Sep 14 04:52:36 EDT 2005 i686 i686 i386 GNU/Linux Fedora Core release 3 (Heidelberg)
and
Microsoft Windows XP Professional Version 2002 Service Pack 2
Pentium(R) 4 CPU 2.80GHz
1GB of RAM
A DESCRIPTION OF THE PROBLEM :
((<[^>]+>)?(((\\s)?)*(\\ )?)*((\\s)?)*)+ pattern causes the matcher to utilize 100% of the CPU when matching against the following pattern:
" < br/> < / p> <p> <html> <adfasfdasdf> p </p>"
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See test case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
GOOD is the expected result.
ACTUAL -
Utilizes 100% of CPU
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegExp
{
public static void main(String[] args)
{
String[] exps = new String[] {
//"<asdfasdf><x>"
//"<p> "
" < br/> < / p> <p> <html> <adfasfdasdf> p </p>"
//" <xx> <adfasfdasdf> p </p>"
};
for (int i = 0; i < exps.length; i++)
{
Pattern p = Pattern.compile("((<[^>]+>)?(((\\s)?)*(\\ )?)*((\\s)?)*)+");
Matcher m = p.matcher(exps[i]);
if (m.matches())
{
System.out.println("replace["+m.replaceAll("REPLACED")+"]");
}
else
{
System.out.println("GOOD");
}
}
}
}
---------- END SOURCE ----------