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 22645 - regression where PropertyChangeEvent(PROP_PRIMARY_FILE ) is not being generated
Summary: regression where PropertyChangeEvent(PROP_PRIMARY_FILE ) is not being generated
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 3.x
Hardware: PC Windows 3.1/NT
: P1 blocker (vote)
Assignee: Petr Hrebejk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-20 02:17 UTC by Andrew Sherman
Modified: 2008-12-23 12:14 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed patch (1021 bytes, patch)
2002-04-24 15:47 UTC, Petr Hrebejk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Sherman 2002-04-20 02:17:35 UTC
The change:

openide/src/org/openide/loaders/DataObject.java
revision 1.63.8.1.4.1
date: 2002/04/15 12:26:57;  author: phamernik;  state: Exp;  lines: +11 -8
#22258 - DataObject.rename causes property sheet to disappear

in orion_fcs branch (but also in trunk I think) causes  PropertyChangeEvents
on PROP_PRIMARY_FILE to be not generated when they were before.

The test 'if (files[0] != files[1])' often seems to evaluate to false and
so the event is not generated.

This is causing regressions in orion code just at code freeze time.
Comment 1 _ ttran 2002-04-20 21:43:50 UTC
Jesse's comment issue 22258
> Petr I suggest a unit test: rename a simple DataObject and confirm
> that PROP_PRIMARY_FILE is *not* fired.

so indeed no PROP_PRIMARY_FILE fired anymore.  I do not have deep
understanding of the DataSystem but the new behavior makes sense.  The
file is the same, it only has a new name.

My wild guess is that the newly corrected behavior of the code exposes
a defect elsewhere.

Added a bunch of people to CC list.  High prio bug.

Hrebejk, please take care of this bug.  Hamernik is on vacation and me
too.  Thanks
Comment 2 Andrew Sherman 2002-04-21 05:16:18 UTC
New behavior may make sense but we are now in high resistance mode for orion. That 
means it is hard to check all the places that rely on the old behavior. So, in my 
opinion we should go back to the old behavior for orion fcs. Of course I do not know 
what the bug is that was fixed by this change, maybe it is critical.
Comment 3 _ ttran 2002-04-21 09:55:19 UTC
> New behavior may make sense but we are now in high resistance mode
> for orion.

for the record, phamernik's fix was integrated _before_ high
resistance mode.

Of course if all parties agree that the fix exposes an even more
serious bug elsewhere in the IDE, then rolling back the fix in
netbeans{orion_fcs} branch (not in CVS trunk) is certainly an option.

Andrew, please describe the effects on your modules.  Then QA and
others will consider them and the effects of not fixing issue 22258.
We won't be able to fix both in NB Core because as it seems to me the
defect code is not there.

A related question is: netbeans{orion_fcs} is Sun's branch, we can do
whatever we want, but release33 (== NB 3.3.2) is not ours, not fixing
issue 22258 there looks bad because that bug is real and affects all
users of NB.
Comment 4 Jesse Glick 2002-04-21 12:31:41 UTC
Probably the last diff of #22258 could be reversed in orion_fcs for
the benefit of existing buggy code in some modules, without affecting
the reported symptoms of #22258 (which should be cured by the rest of
the patch, specifically the part about item.changePrimaryFile).

I agree with Trung that it is undesirable to rollback any part of
#22258 in release33 branch, however, since AFAIK the patch is correct
and fixes a real bug. If we leave out the last part it should be
considered a special hack to support FFJ modules in this release only.
(And these modules should be listed, together with their reasons to
need the hack.)
Comment 5 Andrew Sherman 2002-04-22 05:20:42 UTC
OK, tomorrow (Monday) I will look to see what modules might be affected. 
Comment 6 Jan Chalupa 2002-04-22 09:30:20 UTC
Please do. Try to evaluate the impact on other modules and see if
something is really broken because of this change. The bugfix of
#22258 has been requested by other people working on FFJ and rolling
it back doesn't sound like an option.

I'm changing the version tag to 'FFJ 4.0 ea' and target milestone to
'3.4' to make the bug appear appropriately in the queries. The target
milestone change is not to indicate this is not going to be worked on.
It will be changed when the solution found and a potential bug fix
integrated into the orion_fcs branch.
Comment 7 Andrew Sherman 2002-04-23 01:32:58 UTC
I tried to look for places where listeners were expecting a 
PROP_PRIMARY_FILE (= "primaryFile") event, and were using this to detect a 
simple rename.  

The comment in DataObject.java says:

 /** Name of primary file property. Primary file is changed when the object is 
moved */
 public static final String PROP_PRIMARY_FILE = "primaryFile"; // NOI18N

so some people may have misinterpreted the meaning of this event.

By inspection, I am a bit suspicious of DBschemaDataObject.

By inspection I thought that the code in JavaDataObject looks OK as it 
listens for changes on PROP_FILES as well as PROP_PRIMARY_FILE.  However 
by partially backing out the DataObject change I was able to make another 
of our closed source bugs go away.  In this bug we have a 
PropertyChangeListener on a ClassElement.  We are looking for a 
ElementProperties.PROP_NAME event.  We hope to see this event when the 
class is renamed.  I think that his event was not being generated with the 
DataObject.java change.  When I backed out the change then we detected the 
rename correctly.  

Unfortunately I haven't had time to prove all my theories :-)

The reason I logged this bug (and did not just fix my code) is that a 
change like this can have unforeseen consequences.  If the change really 
did break ClassElement/JavaDataObject then surely there must be some other 
bits of code which got broken.  

Comment 8 Svata Dedic 2002-04-23 07:20:07 UTC
I will track the class rename bug as a separate issue (#22684)
Comment 9 Jan Chalupa 2002-04-23 17:37:43 UTC
I think Andrew's point is valid. No one knows how many modules
building on 3.3.x are depending on the event being fired. It seems to
me that the most reasonable solution would be the one suggested by
Jesse -- keep the fix of #22258 in place, but rollback the last part
which eliminates firing of the "unnecessary" event.

Unlike Jesse, I wouln't consider this to be a special hack for
orion_fcs. The release33 version of the #22258 bugfix should be
exactly the same. The "correct" version should remain in the trunk only.
Comment 10 Petr Hrebejk 2002-04-24 15:47:36 UTC
Created attachment 5544 [details]
Proposed patch
Comment 11 Petr Hrebejk 2002-04-24 15:49:19 UTC
I've tested the solution proposed by Jesse and it seems to work.
Please see the patch, if everybody agrees I will integrate it.
Comment 12 Jesse Glick 2002-04-24 23:56:25 UTC
Sounds OK to me.
Comment 13 Petr Hrebejk 2002-04-25 14:25:10 UTC
Fixed in the orion_fcs branch. The event will still be fired when
renaming DataObject. Please notice that this only applyies to 
versions built on this branch. (Expected id NB 3.3.2 and FFJ 4.0).
This fix is not commited into main trunk i.e. all versions built on
3.4 and later will not fire the PrimaryFileChange on DataObject rename.
Comment 14 Jan Zajicek 2002-04-26 12:46:09 UTC
verified
Comment 15 Quality Engineering 2003-07-01 16:19:17 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.