You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Boris Heithecker (Jira)" <ji...@apache.org> on 2020/07/10 09:44:00 UTC

[jira] [Created] (NETBEANS-4569) Format Java code throws NullPointerException

Boris Heithecker created NETBEANS-4569:
------------------------------------------

             Summary: Format Java code throws NullPointerException
                 Key: NETBEANS-4569
                 URL: https://issues.apache.org/jira/browse/NETBEANS-4569
             Project: NetBeans
          Issue Type: Bug
    Affects Versions: 12.0
            Reporter: Boris Heithecker


Action Format code (Alt+Shift-F) sometimes fails due to a NullPointerException thrown.

Affects Java code. 

I could not determine the exact pattern to reproduce this, but it definitely depends on pieces of the source code. Commenting out parts of the affected class sometimes helps. 

I've been working with the same sources in 11.3 and didn't notice anything like it.

Stack trace: 

java.lang.NullPointerExceptionjava.lang.NullPointerException at org.netbeans.modules.java.source.save.Reformatter$Pretty.scan(Reformatter.java:586) at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitCase(Reformatter.java:2919) at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitCase(Reformatter.java:396) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCase.accept(JCTree.java:1258) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82) at org.netbeans.modules.java.source.save.Reformatter$Pretty.scan(Reformatter.java:600) at org.netbeans.modules.java.source.save.Reformatter$Pretty.handleSwitch(Reformatter.java:2870)

 

Maybe it can be fixed easily by checking for null. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

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