summaryrefslogtreecommitdiffstats
path: root/gerrit-gwtui-common
diff options
context:
space:
mode:
authorChangcheng Xiao <xchangcheng@google.com>2017-02-16 13:48:30 +0100
committerChangcheng Xiao <xchangcheng@google.com>2017-02-17 07:57:03 +0000
commit15615078df91a5c8c9624467bf1542c9b6f13f06 (patch)
tree2cd326cd448298565748a7ba97ae555d52baa3ef /gerrit-gwtui-common
parent3ae681fd6e39a7709a319eefb8d5e87e98b5dfcf (diff)
Fix GWT UI AddFileBox to provide path suggestions continuously
- How to reproduce the bug? In ChangeScreen, click 'Edit', then 'Add...'. Type in some text, you will get some path suggestions. Delete all the text you've typed in. There will be no suggestion any more until the page is reloaded. - Why does this happen? The UI will continue create new query when the text box is focused and the 'query' is null in RemoteSuggestOracle. When the text box is cleared, it will result in a NullPointerException in RESTApi.addParameter(String, String) when it calls URL.encodeQueryString as the request.getQuery() is null. Once this exception happens, onSuggestionReady will not be called and 'query' field in RemoteSuggestOracle will not be reset to null. That's why the UI will not try new Request until the page is reloaded. This problem may be related to GWT 2.8 upgrade. It started behaving differently after the upgrade. However, I haven't noticed this problem for reviewers suggestion. - Solution Set the query to be empty when request.getQuery() is null. Bug: Issue 5365 Change-Id: Ia0878b67aebde854012e3cacec51d922a9f32919
Diffstat (limited to 'gerrit-gwtui-common')
-rw-r--r--gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/RemoteSuggestOracle.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/RemoteSuggestOracle.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/RemoteSuggestOracle.java
index d66d6a60b2..41bf8ceb5a 100644
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/RemoteSuggestOracle.java
+++ b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/RemoteSuggestOracle.java
@@ -104,6 +104,9 @@ public class RemoteSuggestOracle extends SuggestOracle {
}
void start() {
+ if (request.getQuery() == null) {
+ request.setQuery("");
+ }
oracle.requestSuggestions(request, this);
}