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 91700 - Files disappearing from under NetBeans cause NPEs
Summary: Files disappearing from under NetBeans cause NPEs
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-02 20:30 UTC by headius
Modified: 2007-09-26 09:14 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description headius 2007-01-02 20:30:52 UTC
If I have a file open in NetBeans and delete that file outside of NetBeans, when
I come back to NetBeans it throws NPEs while closing those windows. No prompting
or asking whether I want to re-save those files, so if I had any unsaved edits
they'd be lost.

For comparison, Eclipse tells you the file has gone away and asks if you want to
save what you have, recreating the file. Obviously it doesn't NPE.

This is NB6 M4, OS X.
Comment 1 _ tboudreau 2007-01-02 21:35:12 UTC
I believe FileObject does have isVirtual(), originally used for files that
existed in some remote storage but did not exist locally.  I'd imagine MasterFS
could handle unexpectedly deleted local files by keeping the file valid but
making isVirtual true and returning an empty input stream, and the necessary
places would need to check that.

Either way, NPEs on a file being deleted are bugs - it's a condition that should
be handled relatively gracefully.
Comment 2 Jesse Glick 2007-01-02 21:52:38 UTC
I cannot reproduce in a dev build on Linux.

1. Create a text file, open it in NB (--open), go to a terminal and delete it,
switch back to NB. File is closed.

2. Create a file, open it in NB, edit but do not save changes, go to a terminal
and delete it, switch back to NB. Prompt to save/discard/cancel appears. Choose
Save. File recreated on disk, with edited content.

In no case do I get an NPE. Anyway the stack trace is missing so this cannot be
diagnosed until it is attached.
Comment 3 Petr Nejedly 2007-01-03 08:23:37 UTC
This is expected behaviour, which worked this way for years.
The problem is most probably related to some special file type which adds some
additional handling and fails.
What kind of file was the problematic one?
Comment 4 headius 2007-01-03 16:39:50 UTC
Stack trace below. It appears to only happen when several files are deleted.

java.lang.NullPointerException
	at org.netbeans.modules.javacore.parser.ASTProvider.getToken(ASTProvider.java:337)
	at
org.netbeans.modules.javacore.parser.TokenIterator.getNextTokenType(TokenIterator.java:69)
	at
org.netbeans.modules.javacore.scanning.JavaUpdater.makeIndex(JavaUpdater.java:102)
	at
org.netbeans.modules.javacore.scanning.JavaUpdater.computeIndex(JavaUpdater.java:64)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.directUpdate(ResourceImpl.java:719)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:650)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:593)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.isValid(SemiPersistentElement.java:74)
	at
org.netbeans.modules.java.navigation.ClassMemberRelatedItemProvider.getPrimaryItemFromNodes(ClassMemberRelatedItemProvider.java:56)
	at
org.netbeans.modules.java.navigation.spi.RelatedItemProviderSupport$ActiveNodeSupport.findPrimaryItem(RelatedItemProviderSupport.java:365)
	at
org.netbeans.modules.java.navigation.spi.RelatedItemProviderSupport$Updater.run(RelatedItemProviderSupport.java:263)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:541)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:963)
Comment 5 Marian Mirilovic 2007-01-04 10:08:36 UTC
exception from javacore - reassigne
Comment 6 Jesse Glick 2007-01-06 00:32:49 UTC
The code in question is gone in M5 anyway.
Comment 7 Quality Engineering 2007-09-20 12:07:22 UTC
Reorganization of java component