Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-3619

Code Format feature does not work

    XMLWordPrintableJSON

Details

    Description

      When there is no selected code, "Source -> Format" (CTRL + SHIFT + F) does not work.

      Netbeans logging records the following exception:

       

       

      SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.progress.ui.RunOffEDTImpl$1
      java.lang.NullPointerException
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.scan(Reformatter.java:580)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitCase(Reformatter.java:2705)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitCase(Reformatter.java:395)
      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:580)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.handleSwitch(Reformatter.java:2656)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitSwitch(Reformatter.java:2568)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitSwitch(Reformatter.java:395)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1229)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.scan(Reformatter.java:580)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitBlock(Reformatter.java:1764)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitBlock(Reformatter.java:395)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1032)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.scan(Reformatter.java:580)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitMethod(Reformatter.java:1337)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitMethod(Reformatter.java:395)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:898)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.scan(Reformatter.java:580)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitClass(Reformatter.java:1024)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitClass(Reformatter.java:395)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.scan(Reformatter.java:580)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitCompilationUnit(Reformatter.java:625)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.visitCompilationUnit(Reformatter.java:395)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:591)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
      at org.netbeans.modules.java.source.save.Reformatter$Pretty.reformat(Reformatter.java:512)
      at org.netbeans.modules.java.source.save.Reformatter.reformatImpl(Reformatter.java:226)
      at org.netbeans.modules.java.source.save.Reformatter.reformat(Reformatter.java:99)
      at org.netbeans.modules.editor.indent.TaskHandler$MimeItem.runTask(TaskHandler.java:550)
      at org.netbeans.modules.editor.indent.TaskHandler.runTasks(TaskHandler.java:309)
      at org.netbeans.modules.editor.indent.IndentImpl.reformat(IndentImpl.java:349)
      at org.netbeans.modules.editor.indent.api.Reformat.reformat(Reformat.java:129)
      at org.netbeans.editor.ActionFactory$FormatAction$1$1.run(ActionFactory.java:1854)
      at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:333)
      at org.netbeans.editor.ActionFactory$FormatAction$1.run(ActionFactory.java:1833)
      at org.netbeans.modules.progress.ui.RunOffEDTImpl$1.run(RunOffEDTImpl.java:146)
      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
      at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
      at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
      [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
      SEVERE [null]: Last record repeated 3 more times.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            ggalvanv Gabriel Galvan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: