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 132922 - NullPointerException at org.netbeans.modules.xml.multiview.XmlMultiViewDataObject$DataCache.createInputStream
Summary: NullPointerException at org.netbeans.modules.xml.multiview.XmlMultiViewDataOb...
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: EJB (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Martin Fousek
URL: http://statistics.netbeans.org/except...
Keywords:
: 211910 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-15 20:38 UTC by emiddio
Modified: 2012-05-07 19:12 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 47164


Attachments
stacktrace (2.49 KB, text/plain)
2008-04-15 20:38 UTC, emiddio
Details
proposed patch (874 bytes, patch)
2012-04-16 07:24 UTC, Martin Fousek
Details | Diff
patch v2 (874 bytes, patch)
2012-04-16 07:50 UTC, Martin Fousek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description emiddio 2008-04-15 20:38:02 UTC
Build: NetBeans IDE 6.1 RC1 (Build 200804100130)
VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_05-b13
OS: Windows XP, 5.1, x86

User Comments:
Comment 1 emiddio 2008-04-15 20:38:10 UTC
Created attachment 60232 [details]
stacktrace
Comment 2 Erno Mononen 2008-09-11 13:13:04 UTC
Probably caused by synchronization defiencies in xml.multiview. It is a bit risky area, so I'll look at this post 6.5.
Comment 3 _ gowri 2008-11-19 22:41:38 UTC
Marking it to future-later
Comment 4 Quality Engineering 2009-11-02 11:14:39 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX
Comment 5 Petr Jiricka 2010-04-21 15:04:30 UTC
The exception reports are now reappearing, so reopening.
Comment 6 Martin Fousek 2012-04-16 07:24:41 UTC
Created attachment 118300 [details]
proposed patch
Comment 7 Martin Fousek 2012-04-16 07:32:28 UTC
On the affected line, the "encodingHelper" can't be null, so the problem has to lie in "getStringData()" method.

Method loadData seems to be initializing buffer to at least empty string in all cases except the one, where fileTime can equal to last modified time of the file. But in cases when file is missing or IO troubles happens during getting modification time, it can be zero and the buffer stays uninitialized which can lead to NPE.
Comment 8 Martin Fousek 2012-04-16 07:50:56 UTC
Created attachment 118305 [details]
patch v2

I changed the patch a little bit to cover also the situation with IO error.
Comment 9 Martin Fousek 2012-04-16 07:55:29 UTC
Svato please, could you take a look on the last attached patch?

Finally I tried to involve also situation of IO troubles although all stacktraces I saw are only fileDeleted event related.
Comment 10 Svata Dedic 2012-04-17 10:01:42 UTC
What about similar change to reloadData(), which also tries to avoid reloads on file changes ?
Comment 11 Martin Fousek 2012-04-17 11:59:40 UTC
Firstly, thanks Svata for looking on the patch...

(In reply to comment #10)
> What about similar change to reloadData(), which also tries to avoid reloads on
> file changes ?

Actually I didn't understand if you mean similar change to reloadData instead of loadData or change also into reloadData. Anyway I'll try to explain why I would stay just with the change I already provided:

If I'm not missing anything fix into loadData is needed since it's first place called in xml multiview from current stacktraces.

And about the reloadData() - it looks to me that it doesn't initialize anything so in cases when the modification time would be zero it ends, there is no initialization code further - at least it looks to me so.

What do you think?
Comment 12 Svata Dedic 2012-04-17 12:06:27 UTC
I see - sorry, my mistake. Please proceed with the patch, thanks.
Comment 13 Martin Fousek 2012-04-17 12:13:49 UTC
Thanks a lot Svata for your time and review of the patch.

Patch applied in web-main #2475c2ea6686.
Comment 14 Quality Engineering 2012-04-18 21:30:49 UTC
Integrated into 'main-golden', will be available in build *201204181547* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2475c2ea6686
User: Martin Fousek <marfous@netbeans.org>
Log: #132922 - NullPointerException at org.netbeans.modules.xml.multiview.XmlMultiViewDataObject$DataCache.createInputStream
Comment 15 Svata Dedic 2012-05-07 19:12:33 UTC
*** Bug 211910 has been marked as a duplicate of this bug. ***