Bug 29239 - Refactoring throws exception if .project or .classpath read-only in 2.1 M4
Summary: Refactoring throws exception if .project or .classpath read-only in 2.1 M4
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-09 13:02 EST by Jonathan Gossage CLA
Modified: 2003-01-22 05:45 EST (History)
2 users (show)

See Also:


Attachments
Relevant portion of .log file. (17.50 KB, text/plain)
2003-01-09 13:04 EST, Jonathan Gossage CLA
no flags Details
Contains all .project and .classpath files (17.07 KB, application/octet-stream)
2003-01-16 12:27 EST, Jonathan Gossage CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Gossage CLA 2003-01-09 13:02:45 EST
We like to maintain the .project and .classpath files in our SCM which 
currently is SourceSafe. Since we run VSS in lock mode this means that these 
files are stored as read-only files unless they are specifically checked out.

If you try to run a refactoring, in this case renaming a .java file, and you 
select the "Preview" button on the refactoring dialog and you have any of the 
check-boxes in the new refactoring dialog checked, therefactoring will fail 
and will display the following message in the refactoring dialog.

Internal error while creating a change object. See log for details.

I was hoping that I would get a list of the files that would be affected by 
the refactoring so that I could check them out.

The relevant portion of the log is attached. Note that the file that was to be 
renamed is not part of the project that is being complained about in the log 
file. It looks as if it is necessary to have all .project and .classpath files 
read-write to even find out what files would be affected by a refactoring.

Regards

Jonathan Gossage
Comment 1 Jonathan Gossage CLA 2003-01-09 13:04:27 EST
Created attachment 2942 [details]
Relevant portion of .log file.
Comment 2 Jonathan Gossage CLA 2003-01-09 13:31:45 EST
Some additional information on the environment that created this problem

We are usig the new flexible project structure support. I note that near the 
end of the log Eclipse is complaining that the directory Release/com/apple/mrj 
does not exist in project CryptoadminApi. On our system, the 
directory "Release" is a link to another directory, so it may be possible that 
the link is not being honoured.

Regards

Jonathan Gossage
Comment 3 Jonathan Gossage CLA 2003-01-09 13:44:17 EST
Yet more information.

The path Release/com/apple has been excluded from the CryptoadminApi.

Regards

Jonathan Gossage
Comment 4 Dirk Baeumer CLA 2003-01-10 04:14:10 EST
Somehow JDT Core wants to update the classpath due to searching/indexing, which 
got triggered by refactoring's precondition checking. The type rename 
refactoring doesn't manipulate the .project/.classpath file.

Moving to JDT/Core. 
Comment 5 Philipe Mulet CLA 2003-01-10 04:42:05 EST
Jonathan - do you remember if you had more projects in your workspace (which 
used to be prereq'ed but were missing before - or reciprocally projects that 
disappeared since last time around ?).

The first 2 stacktraces are startup related. When we are about to check our 
index consistency, we force classpath resolution, which wakes up some container 
initializer, ending up updating some classpath. This has the consequence of 
attempting to modify the prereq project list (.project), and apparently this is 
failing to succeed, though a definition update is supposed to check out the 
corresponding file.

I think we are only adding existing projects as prereqs, as opposed to any 
being referenced (no matter if it actually exists), which sounds fair. This 
could explain that at the moment the container is initialized, we update the 
classpath and notice only at that time the project prereq addition/deletion.

A simple fix would be to ignore project existence when adding prereq project 
references, need to check some more.

Also why is the checkout of .project not working ? Is it not occurring if 
during startup ?
Comment 6 Philipe Mulet CLA 2003-01-10 04:43:49 EST
John - can you comment on the .project not being checked out for free ?
Comment 7 Jonathan Gossage CLA 2003-01-10 07:57:56 EST
All SCM operations have to be performed outside Eclipse in our environment 
since we have found the SourceSafe team plugin to be unreliable. In addition, 
with the addition of links in M4 which this plugin does not understand, the 
plugin has become totally unusable.

Therefore, since we use SourceSafe in locking mode, all files that have not 
been explicitly checked out in advance will be read-only, and I doubt that 
Eclipse would be able to do an automatic checkout itself, given that there is 
no team plugin installed. So this is the reason why the .project file was read-
only.
Comment 8 Philipe Mulet CLA 2003-01-10 08:52:25 EST
Ok, I understand now... are you positive that no project got added/removed in 
between the two sessions ?
Comment 9 Jonathan Gossage CLA 2003-01-10 10:04:03 EST
This was a single run and the two log entries were only a few minutes apart. 
If anything happened it was not apparent.

Regards

Jonathan Gossage
Comment 10 Philipe Mulet CLA 2003-01-16 04:35:34 EST
Smells related to bug 29585. No .classpath/.project change should occur when a 
container/variable is initialized.

Comment 11 Jerome Lanneluc CLA 2003-01-16 06:15:15 EST
Jonathan, according to the stack trace, the exception occured during the 
workbench startup, not during refactoring. Can you confirm this?
Comment 12 Jonathan Gossage CLA 2003-01-16 07:05:24 EST
I was getting the same symptom both at workbench startup and when making a 
refactoring request. I only discovered that I was also getting this during 
startup after filing the bug report.

Regards

Jonathan Gossage
Comment 13 Jerome Lanneluc CLA 2003-01-16 09:22:22 EST
Thanks Jonathan. Looking at the code, I don't understand how this can happen. 
In the newsgroup I saw you're having problem with your workspace (might be 
corrupt). Can you try to reproduce this problem by creating a new workspace, 
and by checking out your projects with VSS?

If you still have the problem, could you please attach your .project 
and .classpath file to this bug?
Comment 14 Jonathan Gossage CLA 2003-01-16 12:27:15 EST
Created attachment 3013 [details]
Contains all .project and .classpath files
Comment 15 Jerome Lanneluc CLA 2003-01-17 09:24:39 EST
Sorry Jonathan, but I still cannot reproduce the problem. I created a workspace 
with the .classpath and .project files you attached, and when I start it up, it 
goes smoothly.

Note that I had to bind the classpath variables to fake jars as I don't have 
those.

Were you able to reproduce the problem in a new workspace?
Comment 16 Jonathan Gossage CLA 2003-01-17 15:14:31 EST
Things seem to have gone down-hill for me. It looks as if I am going to have 
to completely rebuild everything in my workspace since I tried to rename my 
projects. This resulted in my losing the link information in the .project 
files and even after restoring this information by hand Eclipse could no 
longer see any source files in my projects.

I am going to rebuild the environment and retry the original problem then. It 
really looks to me, though, as if the new link facility is very fragile at the 
moment and needs a good deal of hardening. 

Once we get through these problems, I have several more apparently link 
related problems to report.
Comment 17 John Arthorne CLA 2003-01-17 15:42:43 EST
I would encourage you to log other link-related problems as soon as possible. 
We are currently going through a mini test pass to clear up problems related to
linked resources.  Reporting the problems as soon as possible increases the
chance that we are able to fix them before M5.
Comment 18 Jonathan Gossage CLA 2003-01-20 11:27:57 EST
I rebuilt my workspace and I now get a different symptom when I try to rename 
a file. Now when the "Rename Compilation Unit" dialog comes up, the "Preview" 
and "OK" buttons are disabled but no explanation is given as to why this 
should be so. I suspect that it is because all files are read-only since they 
have not been checked out from SourceSafe.

I also tried checking out the file I was trying to rename and then renaming it 
but I got the same symptom.

Regards

Jonathan
Comment 19 Jerome Lanneluc CLA 2003-01-21 10:54:42 EST
Jonathan, so you didn't get the exception on startup this time? In this case I 
will close this bug (unless you say otherwise).

For the problem with the disabled buttons, please open a separate bug against 
JDT UI.
Comment 20 Jonathan Gossage CLA 2003-01-21 11:19:05 EST
Thats fine.

Regards

jonathan Gossage
Comment 21 Jerome Lanneluc CLA 2003-01-22 05:45:36 EST
Closing