Bug 8863 - .classpath gets overwritten if there's an XML error
Summary: .classpath gets overwritten if there's an XML error
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 F2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-31 14:18 EST by Brian Slesinsky CLA
Modified: 2002-06-04 04:54 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Slesinsky CLA 2002-01-31 14:18:41 EST
If you edit the .classpath by hand and make a mistake in the XML, when you open
the project, the .classpath file is silently ignored and a nonsensical build
happens.  When you close the project again, the .classpath is overwritten and
you lose your changes.

Suggested solution is that opening the project should fail with an error message
telling you which line has the error in the .classpath file.
Comment 1 Erich Gamma CLA 2002-01-31 16:28:26 EST
The .classpath file is a system file and is not intended to be edited by hand.

Moving to Jdt Core fyi
Comment 2 Philipe Mulet CLA 2002-02-01 10:30:51 EST
A bug in the .classpath is equivalent to no classpath file, a default one is 
generated then based on the in memory state.

Closing
Comment 3 Brian Slesinsky CLA 2002-02-01 13:13:03 EST
The current behavior is non-obvious and most projects cannot possibly compile if
the .classfile is bad.  At the very least, you need to put up a dialog box
explaining that the Java build path was discarded, so that the user can create a
new one.

The XML parser must be throwing an exception that is suppressed somewhere. 
Suppressing errors is never a good design practice!  I'm disappointed in how
this bug is being handled.
Comment 4 Philipe Mulet CLA 2002-02-02 07:42:59 EST
Fault tolerance is another good design practice. The rule is that this file is 
managed by JavaCore, not meant to be edited.

If this requirement was changed, then yes your claim would be legite, but until 
it does the current behavior is acceptable, not great but reasonable given the 
base assumption.

Now if you can elaborate one why this file should be editable, then maybe we 
could reconsider this.

It isn't currently on the 2.0 plan, and will move it to LATER for post2.0 
reconsideration (so please explain why you think it is a great idea).
Comment 5 Brian Slesinsky CLA 2002-02-04 13:16:44 EST
See bug 8721 for the reason I need to edit .classpath in release 1.0.  (The GUI
is currently rather tedious for setting up large classpaths based on classpath
variables.)

I do agree that fault tolerance is good in the sense that the user should not be
stuck if .classpath is missing or corrupted.  But the current method of recovery
makes little sense because Eclipse is unlikely to regenerate a correct
.classpath automatically - user intervention is needed, and for that to happen
the user must be informed.  

Also, the best form of recovery may be to get the most recent version of
.classpath from a backup rather than starting from scratch.

Comment 6 Philipe Mulet CLA 2002-05-31 17:13:49 EDT
Latest behavior is that if an error is detected after reconciling a change, the 
change will be ignored, but a marker will be added so as to inform something 
whent wrong. The actual stack trace is logged to the .log file.

Throwing an exception would break pretty much everything...

Closing, please reopen if this behavior isn't matching your expectations.
Comment 7 Philipe Mulet CLA 2002-05-31 17:14:05 EDT
Closed
Comment 8 Philipe Mulet CLA 2002-06-04 04:54:25 EDT
Verified