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 64980 - Too much time spent in ProjectClassPathImplementation.getPath() calling to FileUtil.isArchiveFile()
Summary: Too much time spent in ProjectClassPathImplementation.getPath() calling to Fi...
Status: RESOLVED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2005-09-23 12:08 UTC by Antonin Nebuzelsky
Modified: 2005-10-03 10:39 UTC (History)
1 user (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 Antonin Nebuzelsky 2005-09-23 12:08:19 UTC
During startup with all netbeans projects open (nbbuild and the required
projects) profiler measured >2% of the time spent in
ProjectClassPathImplementation.getPath() calling to FileUtil.isArchiveFile().

Tomasi, is it really necessary to call the expensive FileUtil.isArchiveFile()
which opens the file and reads heading to verify it is a ZIP format file???

Could you do with only examining file extension?
Comment 1 Tomas Zezula 2005-09-23 12:29:24 UTC
It is impossible to check the extension since unlike most other platforms
NetBeans has no mime-type registry which associates extensions to mime-types
(eg. text/html={html, xhtml, htm}
The ProjectClassPathImplementation has no other way than to read the header of
file to find out if it is a zip file. Don't forget that zip file can be: .zip,
.jar, .war, .ear, .xar, .......
Comment 2 Antonin Nebuzelsky 2005-09-23 12:52:11 UTC
Are you sure that anything else than .jar or .zip makes sense on classpath???

WARs, EARs and other xxRs are produced during building of various project types
and deployed to servers, but I am not sure they can appear on a classpath...
Comment 3 Tomas Zezula 2005-09-23 13:01:34 UTC
For me only the jar and zip makes sence, however I cannot limit other to name
the archives as they want.
Comment 4 _ tboudreau 2005-09-26 17:16:42 UTC
Silly question perhaps, but why not have a system property that defines all extensions that are 
considered archive files, and document that.  If someone using the platform wants to define additional 
extensions, they can use it;  if they want the current behavior (read the file), then make it null.

Alternatively, will there ever be a case where .zip and .jar are *not* archive file extensions?  If not, we 
should be able to at least assume that files called .zip and .jar are archives, right?
Comment 5 Tomas Zezula 2005-10-03 10:39:09 UTC
More nicer solution is to register a MIMETypeResolver for zip and jar extensions,
any module can add new one. The FileUtil.isArchiveFile () can be changed to
firstly check if fo.getMimeType() returns the zip archive mime type and if so
not to read the zip header.