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 35219 - after saved and reload fileset does not recognize its elements
Summary: after saved and reload fileset does not recognize its elements
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 3.x
Hardware: All All
: P1 blocker (vote)
Assignee: issues@projects
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-31 14:30 UTC by Pavel Buzek
Modified: 2004-04-19 16:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
commit log (443 bytes, text/plain)
2003-08-01 16:34 UTC, Pavel Buzek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Buzek 2003-07-31 14:30:35 UTC
- create a DataObjectFileset
- put a DataObject in it and store it in a Context
- restart the IDE and get the fileset from the Context
- find the DataObject that you stored in the fileset
- contains () returns false
- toDataObjectSet().contains() also returns false

on the other hand:
(DataObject []) FileSets.toDataObjectSet (links,
false).toArray (new DataObject [] {})

contains the data object...
Comment 1 Pavel Buzek 2003-07-31 14:32:03 UTC
btw: remove (data object) also does not work for a data object that is
in the array mentioned above
Comment 2 Vitezslav Stejskal 2003-07-31 14:37:39 UTC
It sounds like serious defect.
Comment 3 Pavel Buzek 2003-07-31 17:34:25 UTC
after more investigation this is what I found:

The problem is that URLs in the fileset retrieved from persistent
format and URLs created for files in IDE are not equal even if they
point to the same file. One problem is that the HOST of URL is not
same. For URL created from files the host is null (using
URLMapper.findURL(fo, URLMapper.INTERNAL)), for the URL created by the
fileset reader it is an empty string (using new URL (String)).
Comment 4 Pavel Buzek 2003-08-01 16:34:02 UTC
Created attachment 11190 [details]
commit log
Comment 5 Pavel Buzek 2003-08-01 16:46:46 UTC
The problem was in using new URL(String) to create urls when reading
from disk as oposed to using new URI(String).toURL() to get url for
filesystems. The URLs differ in host. When using new URL(String) the
host is set to "". In the new URI(String) the host is set to null. On
1.4.1 there is probably a bug that new URI().toURL() sets the host in
url to "" even though it is null on the URI. On 1.4.2 this was 'fixed'
so that the null host is copied into URL.

MasterFSURLMapper uses file.toURI().toURL() to create URLs. If I
change this to file.toURL() other things in IDE do not work (NPE in
FileUtil #277). I expect then using URI is the policy.  Jesse, is that
correct? Thanks.
Comment 6 Jesse Glick 2003-08-05 17:54:27 UTC
Yes, file.toURI().toURL() should be used generally in the trunk (it is
1.4-specific). File.toURL has a number of bugs and problems which will
never be fixed - for some strange reason it is not @deprecated, but
consider it deprecated.
Comment 7 Jan Becicka 2003-11-25 14:04:48 UTC
As described in
http://www.netbeans.org/servlets/ReadMsg?msgId=619519&listName=nbdiscuss the
current work on projects prototype has been stopped.

Marking issue as VERIFIED --->
Comment 8 Jan Becicka 2003-11-25 14:13:56 UTC
---> CLOSED