Preventing some exceptions from the editor-based duplicates.
authorJan Lahoda <jlahoda@netbeans.org>
Tue, 05 Apr 2011 06:43:49 +0200
changeset 563eeab97f23a4b
parent 562 1c99c566076f
child 564 f2992d7dfe7e
Preventing some exceptions from the editor-based duplicates.
api/src/org/netbeans/modules/jackpot30/impl/duplicates/indexing/RemoteDuplicatesIndex.java
     1.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/duplicates/indexing/RemoteDuplicatesIndex.java	Wed Mar 23 22:45:54 2011 +0100
     1.2 +++ b/api/src/org/netbeans/modules/jackpot30/impl/duplicates/indexing/RemoteDuplicatesIndex.java	Tue Apr 05 06:43:49 2011 +0200
     1.3 @@ -169,7 +169,9 @@
     1.4                          }
     1.5                      }
     1.6  
     1.7 -                    assert current != null : insideHash.getKey();
     1.8 +                    if (current == null) {
     1.9 +                        continue;
    1.10 +                    }
    1.11  
    1.12                      Collection<String> dupes = hashResult.get(current);
    1.13  
    1.14 @@ -193,6 +195,11 @@
    1.15              URI u = new URI(indexURL + "/findDuplicates?hashes=" + WebUtilities.escapeForQuery(Pojson.save(hashes)));
    1.16              String hashesMap = WebUtilities.requestStringResponse(u);
    1.17  
    1.18 +            if (hashesMap == null) {
    1.19 +                //some kind of error while getting the duplicates (cannot access remote server)?
    1.20 +                //ignore:
    1.21 +                return Collections.emptyMap();
    1.22 +            }
    1.23              return Pojson.load(LinkedHashMap.class, hashesMap);
    1.24          } catch (URISyntaxException ex) {
    1.25              //XXX: better handling?