NPE when formatting ShopOrd.apy release701
authorSubhashini Sooriarachchi <subslk@netbeans.org>
Thu, 24 May 2012 10:09:05 +0530
branchrelease701
changeset 228e2e717f9d9f7
parent 227 7aae8609286d
child 229 c0a56e4dd133
NPE when formatting ShopOrd.apy
PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java
     1.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java	Tue May 22 15:39:53 2012 +0200
     1.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java	Thu May 24 10:09:05 2012 +0530
     1.3 @@ -671,15 +671,17 @@
     1.4  
     1.5                      if (temp != null) {
     1.6                          tokenTemp = getEndParent(temp);
     1.7 -                        // check whether this is not just BEGIN/END block. i.e it's part of function/procedure BEGIN
     1.8 -                        if (tokenTemp.getImage().trim().equalsIgnoreCase("BEGIN") && !nextToken.getImage().trim().equals(";")) {
     1.9 -                            temp = getPreviousToken(tokenTemp);
    1.10 +                        if (tokenTemp != null && nextToken != null) {
    1.11 +                            // check whether this is not just BEGIN/END block. i.e it's part of function/procedure BEGIN
    1.12 +                            if (tokenTemp.getImage().trim().equalsIgnoreCase("BEGIN") && !nextToken.getImage().trim().equals(";")) {
    1.13 +                                temp = getPreviousToken(tokenTemp);
    1.14  
    1.15 -                            if (temp != null) {
    1.16 -                                tokenTemp = getBeginParent(temp);
    1.17 -                                tokenTemp = getPreviousToken(tokenTemp);
    1.18 -                            } else {
    1.19 -                                break;
    1.20 +                                if (temp != null) {
    1.21 +                                    tokenTemp = getBeginParent(temp);
    1.22 +                                    tokenTemp = getPreviousToken(tokenTemp);
    1.23 +                                } else {
    1.24 +                                    break;
    1.25 +                                }
    1.26                              }
    1.27                          }
    1.28                      } else {