| Summary: | [GANTT] IllegalArgumentException when event name contains special characters | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Wim Jongman <wim.jongman> |
| Component: | Nebula | Assignee: | Makenna Fish <makenna.g.kai> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | makenna.g.kai |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| See Also: |
https://git.eclipse.org/r/73675 https://git.eclipse.org/c/nebula/org.eclipse.nebula.git/commit/?id=37adf5c2444c1b74f93be86cc347fd11daa83cc4 |
||
| Whiteboard: | |||
|
Description
Wim Jongman
consider replacing with:
try {
toReturn = toReturn.replaceAll(Constants.STR_NAME, ge.getName());
} catch (IllegalArgumentException e) {
toReturn = toReturn.replaceAll(Constants.STR_NAME, Matcher.quoteReplacement(ge.getName()));
}
replaceAll javadoc:
Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher.replaceAll. Use Matcher.quoteReplacement(java.lang.String) to suppress the special meaning of these characters, if desired.
(In reply to comment #1) > consider replacing with: > > try { > toReturn = toReturn.replaceAll(Constants.STR_NAME, ge.getName()); > } catch (IllegalArgumentException e) { > toReturn = toReturn.replaceAll(Constants.STR_NAME, > Matcher.quoteReplacement(ge.getName())); > } Yes, that fixed it. The reason I did a try and not always do the quoteReplacement is that I assume that the text normally does not contain these characters and save some precious milliseconds. However, there is the case when the text does contain some special texts and the IAE is not thrown. This has to be dealt with when somebody reports this. do you want me to commit this change? Wim, have there been any updates to this issue? I'm currently using a workaround, any chance we can go ahead and apply this fix? (In reply to Makenna Fish from comment #3) > Wim, have there been any updates to this issue? I'm currently using a > workaround, any chance we can go ahead and apply this fix? You're on a roll Makenna. Thanks. Please go ahead and put it in. No problem, I'm glad I could help! New Gerrit change created: https://git.eclipse.org/r/73675 Gerrit change https://git.eclipse.org/r/73675 was merged to [master]. Commit: http://git.eclipse.org/c/nebula/org.eclipse.nebula.git/commit/?id=37adf5c2444c1b74f93be86cc347fd11daa83cc4 |