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 256780 - NullPointerException at com.sun.source.util.TreePath.<init>
Summary: NullPointerException at com.sun.source.util.TreePath.<init>
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-25 14:18 UTC by Exceptions Reporter
Modified: 2018-04-23 07:20 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 198663


Attachments
stacktrace (3.76 KB, text/plain)
2015-11-25 14:18 UTC, Exceptions Reporter
Details
stacktrace (3.76 KB, text/plain)
2016-01-16 21:54 UTC, jasonkb
Details
stacktrace (3.76 KB, text/plain)
2017-06-21 20:22 UTC, javydreamercsw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2015-11-25 14:18:32 UTC
This bug was originally marked as duplicate of bug 226050, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 8.1 (Build 201510222201)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.40-b25, Java(TM) SE Runtime Environment, 1.8.0_40-b26
OS: Windows 7

User Comments:
GUEST: <Please provide a description of the problem or the steps to reproduce>not sure how the exception triggered. i think i saw it when at netbeans started

GUEST: package objectstreams;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.math.BigDecimal;
import java.util.Calendar;


public class ObjectStreams {
static final String dataFile = "invoicedata";
static final BigDecimal[] ceny = {
    new BigDecimal("19.99"),
     new BigDecimal("9.99"),
     new BigDecimal("15.90"),
          new BigDecimal("3.99"),
     new BigDecimal("4.99") };
 static final int[] jednotky = {12, 8, 13, 29, 50};
 static final String[] popisy = {
     "Tricko Java",
         "Hrncek Java",
 "Figurka Java",
 "Odznak Java",
 "Klicenka Java"    };
    
    public static void main(String[] args) throws IOException, ClassNotFoundException {
      ObjectOutputStream vystup = null;
      try {
          vystup = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(dataFile)));
          vystup.writeObject(Calendar.getInstance());
          for (int i = 0; i < ceny.l

GUEST: Running an application that simply queries data and prints an output to the screen

GUEST: fuk ye mum m90<Please provide a description of the problem or the steps to reproduce>

GUEST: no idea




Stacktrace: 
java.lang.NullPointerException
   at com.sun.source.util.TreePath.<init>(TreePath.java:102)
   at org.netbeans.modules.java.source.matching.CopyFinder.checkListsWithMultistatementTrees(CopyFinder.java:762)
   at org.netbeans.modules.java.source.matching.CopyFinder.checkLists(CopyFinder.java:631)
   at org.netbeans.modules.java.source.matching.CopyFinder.visitBlock(CopyFinder.java:808)
   at org.netbeans.modules.java.source.matching.CopyFinder.visitBlock(CopyFinder.java:120)
   at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:924)
Comment 1 Exceptions Reporter 2015-11-25 14:18:35 UTC
Created attachment 157491 [details]
stacktrace
Comment 2 jasonkb 2016-01-16 21:54:39 UTC
Created attachment 158156 [details]
stacktrace

Cut out a body of text from a source file with command+c. Exception immediately came.
Comment 3 Dusan Balek 2016-09-13 08:20:26 UTC
Null should not be passed as a parent path to the TreePath constructor.
Comment 4 Svata Dedic 2016-11-10 10:02:45 UTC
Reporters: could you please attach the entire source, or at least a fragment of it ? The defect is triggered by a piece of code which is a candidate to convert to try-with-resources:

[final] X var = ...; // X extends AutoCloseable
...
(code possibly wrapped in try - finally)

var.close(); // possibly in finally clause


It's possible that the code fragment which triggers the defect contains a syntax error or something which screws up the parse tree.


Dusane: It seems the null item in the BlockTree.getStatements() list comes from javac's output for the source code, not the pattern. The defect exists across different javac versions in the code path triggered by the same set of patterns.
Comment 5 javydreamercsw 2017-06-21 20:22:27 UTC
Created attachment 164593 [details]
stacktrace

Not sure what triggered it.