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 171953 - FileUtil.toFile(masterFileObject) generates disk touch. Why?
Summary: FileUtil.toFile(masterFileObject) generates disk touch. Why?
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jiri Skrivanek
URL:
Keywords:
Depends on:
Blocks: 171330
  Show dependency tree
 
Reported: 2009-09-10 16:40 UTC by Jaroslav Tulach
Modified: 2009-09-13 21:04 UTC (History)
0 users

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 Jaroslav Tulach 2009-09-10 16:40:35 UTC
While investigating issue 171330 (how much disk touches we generate when enter is pressed in the IDE) I have found out 
following suspicious call:

    org.netbeans.performance.j2se.actions.CountingSecurityManager.checkRead(CountingSecurityManager.java:118)
    java.io.File.exists(File.java:731)
    org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.exists(FileChangedManager.java:97)
    org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.getAttribute(BaseFileObj.java:350)
    org.openide.filesystems.FileUtil.toFile(FileUtil.java:832)

The FileObject passed to FU.toFile is masterfs, it is known to represent a file on disk (once), so it look useless to 
check whether it really exists or not. Can you please remove the call to File.exists()?

If consistency is important: There is the SecurityManager based cache and if it does not know about the file in 
question being deleted, it shall be save to assume that it exists. Absolute consistency cannot be guaranteed anyway 
the file can be deleted after call to File.exists().
Comment 1 Jiri Skrivanek 2009-09-11 10:27:36 UTC
I don't know why it check existence. But it seems it is not needed. I removed it and we will see whether it breaks
something.

core-main #8fb717b59e1c
Comment 2 Quality Engineering 2009-09-13 21:04:03 UTC
Integrated into 'main-golden', will be available in build *200909131354* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/8fb717b59e1c
User: Jiri Skrivanek <jskrivanek@netbeans.org>
Log: #171953 - Check for existence seems to be useless.