[hg] main-silver: #223194:NullPointerException at org.netbeans.m...

  • From: Tomas Zezula < >
  • To:
  • Subject: [hg] main-silver: #223194:NullPointerException at org.netbeans.m...
  • Date: Tue, 04 Dec 2012 09:08:49 -0800

changeset a9c310852330 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/a9c310852330
description:
        #223194:NullPointerException at 
org.netbeans.modules.parsing.impl.indexing.ClusteredIndexables.access$500

diffstat:

 
parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
 |  71 +++++++++-
 1 files changed, 65 insertions(+), 6 deletions(-)

diffs (171 lines):

diff --git 
a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
 
b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
--- 
a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
+++ 
b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
@@ -44,6 +44,7 @@
 
 import java.lang.ref.Reference;
 import java.lang.ref.SoftReference;
+import java.text.MessageFormat;
 import java.util.AbstractCollection;
 import java.util.ArrayList;
 import java.util.BitSet;
@@ -257,6 +258,10 @@
         private List<String> toDeleteOutOfOrder;
         private Reference<List[]> dataRef;
 
+        private volatile Pair<Long,StackTraceElement[]> 
attachDeleteStackTrace;
+        private volatile Pair<Long,StackTraceElement[]> 
attachIndexStackTrace;
+        private volatile Pair<Long,StackTraceElement[]> detachStackTrace;
+
         private DocumentIndexCacheImpl() {}
 
         @Override
@@ -272,11 +277,17 @@
                 ensureNotReBound(this.deleteIndexables, ci);
                 if (!ci.equals(this.deleteIndexables)) {
                     this.deleteIndexables = ci;
+                    attachDeleteStackTrace = 
Pair.<Long,StackTraceElement[]>of(
+                            
System.nanoTime(),Thread.currentThread().getStackTrace());
+                    detachStackTrace = null;
                 }
             } else if (INDEX.equals(mode)) {
                 ensureNotReBound(this.indexIndexables, ci);
                 if (!ci.equals(this.indexIndexables)) {
                     this.indexIndexables = ci;
+                    attachIndexStackTrace = 
Pair.<Long,StackTraceElement[]>of(
+                            
System.nanoTime(),Thread.currentThread().getStackTrace());
+                    detachStackTrace = null;
                 }
             } else {
                 throw new IllegalArgumentException(mode);
@@ -288,6 +299,8 @@
             if (TransientUpdateSupport.isTransientUpdate()) {
                 return;
             }
+            detachStackTrace = Pair.<Long,StackTraceElement[]>of(
+                System.nanoTime(),Thread.currentThread().getStackTrace());
             this.deleteIndexables = null;
             this.indexIndexables = null;
         }
@@ -332,7 +345,10 @@
                     deleteIndexables,
                     deleteFromDeleted,
                     indexIndexables,
-                    deleteFromIndex) :
+                    deleteFromIndex,
+                    attachDeleteStackTrace,
+                    attachIndexStackTrace,
+                    detachStackTrace) :
                 Collections.<String>emptySet();
         }
 
@@ -455,12 +471,19 @@
         private final ClusteredIndexables indexIndexables;
         private final BitSet deleteFromIndex;
         
+        private final Pair<Long,StackTraceElement[]> attachDeleteStackTrace;
+        private final Pair<Long,StackTraceElement[]> attachIndexStackTrace;
+        private final Pair<Long, StackTraceElement[]> detachStackTrace;
+        
         RemovedCollection(
             @NonNull final List<? extends String> outOfOrder,
             @NullAllowed final ClusteredIndexables deleteIndexables,
             @NonNull final BitSet deleteFromDeleted,
             @NullAllowed final ClusteredIndexables indexIndexables,
-            @NonNull final BitSet deleteFromIndex) {
+            @NonNull final BitSet deleteFromIndex,
+            @NullAllowed final Pair<Long,StackTraceElement[]> 
attachDeleteStackTrace,
+            @NullAllowed final Pair<Long, StackTraceElement[]> 
attachIndexStackTrace,
+            @NullAllowed final Pair<Long, StackTraceElement[]> 
detachStackTrace) {
             assert outOfOrder != null;
             assert deleteFromDeleted != null;
             assert deleteFromIndex != null;
@@ -469,6 +492,9 @@
             this.deleteFromDeleted = deleteFromDeleted;
             this.indexIndexables = indexIndexables;
             this.deleteFromIndex = deleteFromIndex;
+            this.attachDeleteStackTrace = attachDeleteStackTrace;
+            this.attachIndexStackTrace = attachIndexStackTrace;
+            this.detachStackTrace = detachStackTrace;
         }
 
         @Override
@@ -478,7 +504,10 @@
                 deleteIndexables,
                 deleteFromDeleted,
                 indexIndexables,
-                deleteFromIndex);
+                deleteFromIndex,
+                attachDeleteStackTrace,
+                attachIndexStackTrace,
+                detachStackTrace);
         }
 
         @Override
@@ -503,17 +532,27 @@
             private int index;
             private String current;
 
+            private final Pair<Long,StackTraceElement[]> 
attachDeleteStackTrace;
+            private final Pair<Long,StackTraceElement[]> 
attachIndexStackTrace;
+            private final Pair<Long, StackTraceElement[]> detachStackTrace;
+
             It(
                 @NonNull final Iterator<? extends String> outOfOrderIt,
                 @NullAllowed final ClusteredIndexables deleteIndexables,
                 @NonNull final BitSet deleteFromDeleted,
                 @NullAllowed final ClusteredIndexables indexIndexables,
-                @NonNull final BitSet deleteFromIndex) {
+                @NonNull final BitSet deleteFromIndex,
+                @NullAllowed final Pair<Long,StackTraceElement[]> 
attachDeleteStackTrace,
+                @NullAllowed final Pair<Long, StackTraceElement[]> 
attachIndexStackTrace,
+                @NullAllowed final Pair<Long, StackTraceElement[]> 
detachStackTrace) {
                 this.outOfOrderIt = outOfOrderIt;
                 this.deleteIndexables = deleteIndexables;
                 this.deleteFromDeleted = deleteFromDeleted;
                 this.indexIndexables = indexIndexables;
                 this.deleteFromIndex = deleteFromIndex;
+                this.attachDeleteStackTrace = attachDeleteStackTrace;
+                this.attachIndexStackTrace = attachIndexStackTrace;
+                this.detachStackTrace = detachStackTrace;
             }
 
             @Override
@@ -533,7 +572,17 @@
                     case 1:
                         index = deleteFromDeleted.nextSetBit(index+1);
                         if (index >=0) {
-                            current = 
deleteIndexables.get(index).getRelativePath();
+                            if (deleteIndexables == null) {
+                                throw new IllegalStateException(
+                                    MessageFormat.format(
+                                        "Attached at: {0} by: {1}, Detached 
at: {2} by: {3}",   //NOI18N
+                                        attachDeleteStackTrace == null ? 
null : attachDeleteStackTrace.first,
+                                        attachDeleteStackTrace == null ? 
null : attachDeleteStackTrace.second,
+                                        detachStackTrace == null ? null : 
detachStackTrace.first,
+                                        detachStackTrace == null ? null : 
detachStackTrace.second));
+                            }
+                            final Indexable file = 
deleteIndexables.get(index);
+                            current = file.getRelativePath();
                             return true;
                         } else {
                             index = -1;
@@ -542,7 +591,17 @@
                     case 2:
                         index = deleteFromIndex.nextSetBit(index+1);
                         if (index >= 0) {
-                            current = 
indexIndexables.get(index).getRelativePath();
+                            if (indexIndexables == null) {
+                                throw new IllegalStateException(
+                                    MessageFormat.format(
+                                        "Attached at: {0} by: {1}, Detached 
at: {2} by: {3}",   //NOI18N
+                                        attachIndexStackTrace == null ? null 
: attachIndexStackTrace.first,
+                                        attachIndexStackTrace == null ? null 
: attachIndexStackTrace.second,
+                                        detachStackTrace == null ? null : 
detachStackTrace.first,
+                                        detachStackTrace == null ? null : 
detachStackTrace.second));
+                            }
+                            final Indexable file = 
indexIndexables.get(index);
+                            current = file.getRelativePath();
                             return true;
                         } else {
                             index = -1;

[hg] main-silver: #223194:NullPointerException at org.netbeans.m...

Tomas Zezula 12/04/2012

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close