This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new b3601d6  [NETBEANS-2980] Fix potential NPE on 
ImportAnalysis2.getPackage()
b3601d6 is described below

commit b3601d6958c12eda5031ffda5abe34ff00603a3e
Author: Laszlo Kishalmi <laszlo.kisha...@gmail.com>
AuthorDate: Wed Aug 14 02:26:26 2019 -0700

    [NETBEANS-2980] Fix potential NPE on ImportAnalysis2.getPackage()
---
 .../src/org/netbeans/modules/java/source/pretty/ImportAnalysis2.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/java/java.source.base/src/org/netbeans/modules/java/source/pretty/ImportAnalysis2.java
 
b/java/java.source.base/src/org/netbeans/modules/java/source/pretty/ImportAnalysis2.java
index 47b9561..e88ef5d 100644
--- 
a/java/java.source.base/src/org/netbeans/modules/java/source/pretty/ImportAnalysis2.java
+++ 
b/java/java.source.base/src/org/netbeans/modules/java/source/pretty/ImportAnalysis2.java
@@ -258,7 +258,7 @@ public class ImportAnalysis2 {
 
     //Note: this method should return either "orig" or a IdentifierTree or 
MemberSelectTree
     //no other tree type is not allowed - see 
ImmutableTreeTranslator.translateStable(Tree)
-    public ExpressionTree resolveImport(MemberSelectTree orig, Element 
element) {
+    public ExpressionTree resolveImport(MemberSelectTree orig, final Element 
element) {
         if (visibleThroughClasses == null || element == null || cs != null && 
cs.useFQNs()) {
             //may happen for package clause
             return orig;
@@ -390,7 +390,7 @@ public class ImportAnalysis2 {
     }
 
     private PackageElement getPackageOf(Element el) {
-        while (el.getKind() != ElementKind.PACKAGE) el = 
el.getEnclosingElement();
+        while ((el != null) && (el.getKind() != ElementKind.PACKAGE)) el = 
el.getEnclosingElement();
 
         return (PackageElement) el;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to