> Thanks for taking the time to write that up and respond. It helped me
> shed a little more light on the issue. It's not the "\\" that causes
> the problem, but rather "\\Q". I've modified RegX and regex.txt a bit
> to highlight the problem. Runtime output is from 1.4, 1.5, and 1.6
> (with the Exception pasted in).
I think you found a bug. Here's an SSCCE that more readily demonstrates
the problem:
<SSCCE>
public class RegExpTest {
public static void main(String args[]) {
System.out.println("Java Version " +
System.getProperty("java.specification.version"));
System.out.println("----------------");
{
// This works
String regex = "G\\\\A";
Pattern pat = Pattern.compile(regex);
}
{
// This works
String regex = "G\\\\B";
Pattern pat = Pattern.compile(regex);
}
{
// This fails
String regex = "G\\\\Q";
Pattern pat = Pattern.compile(regex);
}
}
}
</SSCCE>
It probably has to do with the fact that \Q and \E are used for "super
quoting" in regular expressions, and the parser looks for \Q before escaping
all the \\s first.
So go ahead and file the bug report at Sun's.
- Oliver
hiwa - 13 Dec 2006 02:22 GMT
> > Thanks for taking the time to write that up and respond. It helped me
> > shed a little more light on the issue. It's not the "\\" that causes
[quoted text clipped - 37 lines]
>
> - Oliver
Hmmm..
1.4 fails for:
String regex = "G\\\\Qabc\\E";
at 'E',
but 1.6 doesn't.
and,
1.6 fails for:
String regex = "G\\\\Q";
at resultant '\\Q',
but 1.4 doesn't.
1.4 succeeds with:
String regex = "G\\\\\\Qabc\\E";
Yes, 1.6 has introduced a ner bug.....
hiwa - 13 Dec 2006 02:24 GMT
triVinci@gmail.com - 13 Dec 2006 14:47 GMT
Thanks again!
A bug report was submitted on Nov24.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6497148
> > > Thanks for taking the time to write that up and respond. It helped me
> > > shed a little more light on the issue. It's not the "\\" that causes
[quoted text clipped - 53 lines]
>
> Yes, 1.6 has introduced a ner bug.....
Andrew Thompson - 13 Dec 2006 15:02 GMT
...
> A bug report was submitted on Nov24.
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6497148
Sterling job!
With Sun accepting it as a bug so quickly,
(& identifying a possible source) it seems
my offer of a web-start based test is redundant.
We'll see how it goes.
Andrew T.
Andrew Thompson - 13 Dec 2006 04:03 GMT
....
> I think you found a bug. Here's an SSCCE that more readily demonstrates
> the problem:
....
> So go ahead and file the bug report at Sun's.
JWS would be good for selecting the JVM against
which to test a piece of code.
Would putting up such a test at my site, help the
progress of this bug, or simply be redundant?
(It seems pretty simple and clear-cut, suggesting 'no')
Opinions/thoughs welcome.
Andrew T.
hiwa - 13 Dec 2006 04:19 GMT
> ....
> > I think you found a bug. Here's an SSCCE that more readily demonstrates
[quoted text clipped - 12 lines]
>
> Andrew T.
> Would putting up such a test at my site
Would surely help multiple JDK version test in general.
It's a little bit awkward and pain at a personal local site to do them.