This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 156470

Summary: NPE at com.sun.tools.javac.comp.Flow.visitMethodDef(Flow.java:677)
Product: java Reporter: Jiri Prox <jiriprox>
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: VERIFIED FIXED    
Severity: blocker CC: sustaining
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: file before the code was pasted
form file
dump

Description Jiri Prox 2009-01-08 12:03:24 UTC
Product Version: NetBeans IDE Dev (Build 20090108033400)
Java: 1.6.0_11; Java HotSpot(TM) Client VM 11.0-b16
System: Linux version 2.6.24-22-generic running on i386; UTF-8; en_US (nb)

NPE was thrown when pasting code into the editor

Content of clipboard:

return new JPanel() {
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        Font font = (Font) value;
        String text = font.getFamily();
        FontMetrics fm = g.getFontMetrics(font);
        g.setColor(isSelected ? list.getSelectionBackground() : list
            .getBackground());
        g.fillRect(0, 0, getWidth(), getHeight());
        g.setColor(isSelected ? list.getSelectionForeground() : list
            .getForeground());
        g.setFont(font);
        g.drawString(text, 0, fm.getAscent());
      }

      public Dimension getPreferredSize() {
        Font font = (Font) value;
        String text = font.getFamily();
        Graphics g = getGraphics();
        FontMetrics fm = g.getFontMetrics(font);
        return new Dimension(fm.stringWidth(text), fm.getHeight());
      }
    };

Beginnig of the stacktrace
Annotation: An error occurred during parsing of
'/home/jp159440/NetBeansProjects/QATools/src/org/netbeans/modules/qa/QAToolsPanel.java'. Please report a bug against
java/source and attach dump file '/home/jp159440/.netbeans/dev/var/log/QAToolsPanel_3.dump'.
Annotation: An error occurred during parsing of
'/home/jp159440/NetBeansProjects/QATools/src/org/netbeans/modules/qa/QAToolsPanel.java'. Please report a bug against
java/source and attach dump file '/home/jp159440/.netbeans/dev/var/log/QAToolsPanel_3.dump'.
An error occurred during parsing of
'/home/jp159440/NetBeansProjects/QATools/src/org/netbeans/modules/qa/QAToolsPanel.java'. Please report a bug against
java/source and attach dump file '/home/jp159440/.netbeans/dev/var/log/QAToolsPanel_3.dump'.
An error occurred during parsing of
'/home/jp159440/NetBeansProjects/QATools/src/org/netbeans/modules/qa/QAToolsPanel.java'. Please report a bug against
java/source and attach dump file '/home/jp159440/.netbeans/dev/var/log/QAToolsPanel_3.dump'.
Caused: java.lang.NullPointerException
	at com.sun.tools.javac.comp.Flow.visitMethodDef(Flow.java:677)
	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:657)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
	at com.sun.tools.javac.comp.Flow.visitClassDef(Flow.java:657)
	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:588)
Comment 1 Jiri Prox 2009-01-08 12:04:58 UTC
Created attachment 75581 [details]
file before the code was pasted
Comment 2 Jiri Prox 2009-01-08 12:05:38 UTC
Created attachment 75582 [details]
form file
Comment 3 Jiri Prox 2009-01-08 12:08:31 UTC
Created attachment 75583 [details]
dump
Comment 4 Dusan Balek 2009-01-12 10:45:02 UTC
Fixed.

changeset 3761259f344e in main/nb-javac
details: http://hg.netbeans.org/main/nb-javac?cmd=changeset;node=3761259f344e
changeset 25b51f837760 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=25b51f837760
Comment 5 David Strupl 2009-01-13 08:45:19 UTC
Please note: if someone takes the new javac (s)he must include also fix for #151422 otherwise things will be broken.
Comment 6 Jiri Prox 2009-01-13 11:37:25 UTC
verified in
Product Version: NetBeans IDE Dev (Build 20090113073351)
Java: 1.6.0_11; Java HotSpot(TM) Client VM 11.0-b16
System: Linux version 2.6.24-23-generic running on i386; UTF-8; en_US (nb)
Comment 7 Quality Engineering 2009-01-14 07:45:26 UTC
Integrated into 'main-golden', will be available in build *200901140201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/25b51f837760
User: Dusan Balek <dbalek@netbeans.org>
Log: Issues #152782 and #156470 - fixed.
Comment 8 pgebauer 2009-01-15 09:58:53 UTC
As was mentioned in the third comment above, this issue have to be fixed together with the issue 151422 but IZ#151422 isn't suitable a candidate for a 
patch.