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.
Summary: | NullPointerException at org.netbeans.modules.j2ee.sun.ide.sunresources.resourcesloader.SunResourceDataObject.getResource | ||
---|---|---|---|
Product: | serverplugins | Reporter: | Petr Cyhelsky <cyhelsky> |
Component: | GlassFish | Assignee: | TomasKraus |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | arporral, bht, crosati, cyhelsky, dao, davidsalter, elotter, emiddio, epdv, everflux, janario, jeff_rubinoff, jjuneau, jungi, kganfield, mmirilovic, musilt2, sergej, wklaczynski |
Priority: | P1 | ||
Version: | 7.0 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | 179078 |
Attachments: |
stacktrace
stacktrace stacktrace stacktrace stacktrace stacktrace stacktrace stacktrace stacktrace Simple fix to avoid NPE in SunResourceDataObject.java:191 (from stack traces). NPE safe test for all resource arrays in method. |
Description
Petr Cyhelsky
2011-05-30 09:39:38 UTC
Created attachment 108588 [details]
stacktrace
Created attachment 108651 [details]
stacktrace
after invoking find on multiple project nodes
Do not know why I am getting called with a null FileObject, prevent the NPE by detecting the null and forcing the caller (who should not be asking for the DataObject of a null FileObject) deal with it via an IOException. Integrated into 'main-golden', will be available in build *201106021001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/a283626238cf User: Vince Kraemer <vkraemer@netbeans.org> Log: #198992 : null FileObject causes NPE... probably should not get a null FileObject in the dev build Still happens in: Product Version: NetBeans IDE Dev (Build 201110020601) Java: 1.7.0; Java HotSpot(TM) 64-Bit Server VM 21.0-b18 System: Linux version 2.6.38-11-generic running on amd64; UTF-8; en_US (nb) Steps to reproduce: Have multiple netbeans projects open -> select some of them -> invoke find from popup menu -> try to find something in the selection -> exception pops Created attachment 111794 [details]
stacktrace
searching repository
Created attachment 113112 [details]
stacktrace
searching in hg repository
This bug already has 20 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=179078 Created attachment 124038 [details]
stacktrace
doing Find on Files
Created attachment 128680 [details]
stacktrace
Opening netbeans modules in Netbeans nightly
Created attachment 136022 [details]
stacktrace
Searching through the NetBeans source code and this error occurred.
Created attachment 136763 [details]
stacktrace
.
Created attachment 136764 [details]
stacktrace
.
This bug already has 50 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=179078 http://statistics.netbeans.org/exceptions/exception.do?id=679972 and other reports points to SunResourceDataObject.java:191: JdbcConnectionPool[] pools = resources.getJdbcConnectionPool(); if(pools.length != 0){ ConnPoolBean currCPBean = ConnPoolBean.createBean(pools[0]); type = this.JDBC_CP; setPool(currCPBean); } It looks like pools value can be null and this is causing NPE. Changing condition to if(pools != null && pools.length > 0){ Checked into web-main: ---------------------- changeset: 255036:d17c21d51d68 summary: #198992 - NullPointerException at org.netbeans.modules.j2ee.sun.ide.sunresources.resourcesloader.SunResourceDataObject.getResource I can't push it now because I'm currently working on large set of changes. But fix can be transplanted into 7.4 beta branch when needed. Checked into web-main: ---------------------- changeset: 255037:2d26c1caa59d summary: #198992 - Safe tests for all resources Added NPE safe tests for all pool arrays. I just don't understand one thing. All those if statements are inside try / catch (NullPointerException npe) block. So why NPE is thrown outside of this block? Tomas, please notice that QE *will not test* test fix unless it is in trunk. (Only fix verified by QE can be transplanted to beta branch). (In reply to comment #16) > http://statistics.netbeans.org/exceptions/exception.do?id=679972 and other > reports points to SunResourceDataObject.java:191: > > JdbcConnectionPool[] pools = resources.getJdbcConnectionPool(); > if(pools.length != 0){ > ConnPoolBean currCPBean = ConnPoolBean.createBean(pools[0]); > type = this.JDBC_CP; > setPool(currCPBean); > } > > It looks like pools value can be null and this is causing NPE. > > Changing condition to > > if(pools != null && pools.length > 0){ > > > Checked into web-main: > ---------------------- > changeset: 255036:d17c21d51d68 > summary: #198992 - NullPointerException at > org.netbeans.modules.j2ee.sun.ide.sunresources.resourcesloader.SunResourceDataObject.getResource > > I can't push it now because I'm currently working on large set of changes. But > fix can be transplanted into 7.4 beta branch when needed. Created attachment 136812 [details]
Simple fix to avoid NPE in SunResourceDataObject.java:191 (from stack traces).
Created attachment 136813 [details]
NPE safe test for all resource arrays in method.
Well, I'll push unfinished changes. Fortunately those changes are in GF tooling library (code shared by NB and Eclipse) which are not integrated into NB yet so this code is not used in GF plugin yet. Fix verified in trunk, please integrate it into release74_beta1 branch. Transplanted to branch release74_beta1 as http://hg.netbeans.org/releases/rev/4a3ce52ef83b http://hg.netbeans.org/releases/rev/0524c29e4342 Integrated into 'releases/release74_beta1', will be available in build *201307092200* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/4a3ce52ef83b User: Tomas Kraus <TomasKraus@netbeans.org> Log: #198992 - NullPointerException at org.netbeans.modules.j2ee.sun.ide.sunresources.resourcesloader.SunResourceDataObject.getResource Integrated into 'main-silver', will be available in build *201307100049* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/d17c21d51d68 User: Tomas Kraus <TomasKraus@netbeans.org> Log: #198992 - NullPointerException at org.netbeans.modules.j2ee.sun.ide.sunresources.resourcesloader.SunResourceDataObject.getResource (In reply to comment #24) > Integrated into 'releases/release74_beta1', will be available in build > *201307092200* or newer. Wait for official and publicly available build. > > Changeset: http://hg.netbeans.org/releases/rev/4a3ce52ef83b > User: Tomas Kraus <TomasKraus@netbeans.org> > Log: #198992 - NullPointerException at > org.netbeans.modules.j2ee.sun.ide.sunresources.resourcesloader.SunResourceDataObject.getResource verified |