Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: FEST-Swing 1.2a3
-
Fix Version/s: FEST-Swing 1.2a4
-
Component/s: Swing
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
I just stumpled upon some PatternSyntaxException when using the
JTableFixture.cell(String value).
The documentation says it can be a regex, so I expected this to be
only optional, but it must be.
Now I looked into the implementation and in the method
"org.fest.swing.util.Strings.areEqualOrMatch(String pattern, String s)
is a call to s.match(pattern), which requires a valid regexp to pass
in. So I expected the JTableFixture.cell(String value) to find by
plain string comparison like String.equals(...) or String.contains
(...) or it escapes any invalid regex which is passed in before doing
the match.
I can think about the following solution:
org.fest.swing.util.Strings.areEqualOrMatch(String pattern, String s) {
if (areEqual(pattern, s)) return true;
if (pattern != null && s != null)
try {
return s.matches(pattern);
catch (PatternSyntaxException notARegex)
return false;
}
Activity
| Field | Original Value | New Value |
|---|---|---|
| Fix Version/s | FEST-Swing 1.2a4 [ 15506 ] | |
| Assignee | Alex Ruiz [ alexruiz ] |
| Remaining Estimate | 0 minutes [ 0 ] | |
| Original Estimate | 0 minutes [ 0 ] |
| Status | Open [ 1 ] | In Progress [ 3 ] |
| Resolution | Fixed [ 1 ] | |
| Status | In Progress [ 3 ] | Resolved [ 5 ] |