Bug 515352 - PatternSyntaxException below CommitCombo$CommitContentProposalProvider.getProposals (thrown in Pattern.compile)
Summary: PatternSyntaxException below CommitCombo$CommitContentProposalProvider.getPro...
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 4.6.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-17 17:04 EDT by EPP Error Reports CLA
Modified: 2017-04-17 18:06 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description EPP Error Reports CLA 2017-04-17 17:04:43 EDT
The following problem was reported via the automated error reporting:

Message: Unhandled event loop exception
java.util.regex.PatternSyntaxException: Unexpected internal error near index 4
sdf\
    ^
    at java.util.regex.Pattern.compile(null:-1)
    at java.util.regex.Pattern.<init>(null:-1)
    at java.util.regex.Pattern.compile(null:-1)
    at org.eclipse.egit.ui.internal.dialogs.CommitCombo$CommitContentProposalProvider.getProposals(CommitCombo.java:66)
    at org.eclipse.jface.fieldassist.ContentProposalAdapter.getProposals(ContentProposalAdapter.java:2005)
    at org.eclipse.jface.fieldassist.ContentProposalAdapter.openProposalPopup(ContentProposalAdapter.java:1854)
    at org.eclipse.jface.fieldassist.ContentProposalAdapter.lambda$2(ContentProposalAdapter.java:2038)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4211)



Bundles:
| org.eclipse.egit.ui | 4.6.1.201703071140-r | 4.6.1.201703071140-r |
| org.eclipse.jface | 3.12.1.v20160923-1528 | 3.12.1.v20160923-1528 |
| org.eclipse.swt | 3.105.2.v20161122-0613 | 3.105.2.v20161122-0613 |

Operating Systems:
| Windows | 10.0.0 | 10.0.0 |


The above information is a snapshot of the collected data. Visit https://dev.eclipse.org/recommenders/committers/aeri/v2/#!/problems/58efc589e4b0bef0c9bcf9a3 for the latest data.

Thank you for your assistance.
 Your friendly error-reports-inbox.
Comment 1 Thomas Wolf CLA 2017-04-17 17:34:27 EDT
Occurs in the CreateTagDialog invoked from <Context Menu>->Create Tag... on the "Tags" node of a repository in the repository view. Steps to reproduce (once the dialog is open):

1. Expand the "Advanced" section
2. Type a string that is not a valid regular expression in the field.

The error is logged only; there is no indication in the UI of (a) that the field accepts a regular expression, or (b) that the regular expression is invalid.

Since the content assist is triggered on keystrokes, there may always be times when the input string is an invalid regular expression, and then the error gets logged. The UI behavior is more or less fine, though: the previous content assist remains.

But how can a user search for a commit message containing a regexp meta character, for instance a '('? If he knew it was a regexp, he could just
type \(. But how should he know? The dialog doesn't tell.

How to best fix this?

1. Don't accept a regular expression, just do a substring search. Changes
   behavior and may come as a surprise to users used to use regular
   expressions in that field.
2. Catch the PatternSyntaxException, but then what?
2.1. Return null or an empty proposal list: changes behavior and is confusing.
2.2. Retry with the pattern quoted (i.e., substring search): may change
     the content proposals drastically and in unexpected ways.
2.3. Return the last list of proposals: current UI behavior unchanged, but
     input is simply ignored until the field content forms a valid regular
     expression again, and requires a stateful content proposal provider.