Preventing NPE. separate-by-function-cleanup
authorJan Lahoda <jlahoda@netbeans.org>
Sat, 18 Feb 2012 22:14:03 +0100
branchseparate-by-function-cleanup
changeset 7359769c807a9d6
parent 734 a561406c2d3b
child 736 c23c0b31bd6b
Preventing NPE.
remoting/common/api/src/org/netbeans/modules/jackpot30/common/api/IndexAccess.java
     1.1 --- a/remoting/common/api/src/org/netbeans/modules/jackpot30/common/api/IndexAccess.java	Fri Feb 17 21:37:37 2012 +0100
     1.2 +++ b/remoting/common/api/src/org/netbeans/modules/jackpot30/common/api/IndexAccess.java	Sat Feb 18 22:14:03 2012 +0100
     1.3 @@ -86,14 +86,16 @@
     1.4      
     1.5      public void finish() {
     1.6          this.root = null;
     1.7 -        try {
     1.8 -            w.close();
     1.9 -        } catch (CorruptIndexException ex) {
    1.10 -            throw new IllegalStateException(ex);
    1.11 -        } catch (IOException ex) {
    1.12 -            throw new IllegalStateException(ex);
    1.13 +        if (w != null) {
    1.14 +            try {
    1.15 +                w.close();
    1.16 +            } catch (CorruptIndexException ex) {
    1.17 +                throw new IllegalStateException(ex);
    1.18 +            } catch (IOException ex) {
    1.19 +                throw new IllegalStateException(ex);
    1.20 +            }
    1.21 +            w = null;
    1.22          }
    1.23 -        w = null;
    1.24      }
    1.25      
    1.26      public String getRelativePath(Indexable i) {