Bug 329564 - "Save could not be completed" prevents saving file
Summary: "Save could not be completed" prevents saving file
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.8 M4   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-05 12:51 EDT by John Peberdy CLA
Modified: 2011-12-06 07:28 EST (History)
8 users (show)

See Also:


Attachments
Screenshot of the problem (367.12 KB, image/png)
2010-11-05 12:52 EDT, John Peberdy CLA
no flags Details
Erros message screenshot (14.68 KB, image/png)
2011-11-18 05:17 EST, Veijo Ryhänen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Peberdy CLA 2010-11-05 12:51:30 EDT
Build Identifier: I20090611-1540

After editing a file and attempting to save a dialog popped up "Save Problems": "Save could not be completed. Reason: Operation not supported for specified element..". I'm not sure if this is a core eclipse problem or JDT. In any case a bug in any plugin should never prevent a save. Please see attached screenshot. 
Workaround: Select all, paste elsewhere, close the editor discarding changes, reopen the editor and paste. Now the editor saves correctly.

Reproducible: Couldn't Reproduce
Comment 1 John Peberdy CLA 2010-11-05 12:52:15 EDT
Created attachment 182498 [details]
Screenshot of the problem
Comment 2 Dani Megert CLA 2010-11-05 13:12:35 EDT
JDT Core throws this message.

JDT Core, please investigate.
Comment 3 John Peberdy CLA 2010-11-05 13:43:22 EDT
Some other details: 
- other files could be saved at that time—it was just this file that I couldn’t save.
- It had happened just after I introduced some compile error into the file.
Comment 4 Olivier Thomann CLA 2010-11-05 13:51:45 EDT
We clearly need more information to investigate.
What operation was run ?
Without steps, there is nothing we can do.
Comment 5 John Peberdy CLA 2010-11-05 13:59:10 EDT
(In reply to comment #4)
> We clearly need more information to investigate.
> What operation was run ?

Attempted to save the dirty editor

> Without steps, there is nothing we can do.

Not reproducible. I can provide configuration dump. In any case the logic should be evaluated: a bug/exception thrown by JDT should not prevent a save.
Comment 6 Olivier Thomann CLA 2010-11-05 14:17:36 EDT
We need at least the stack trace that led to this dialog.
Comment 7 John Peberdy CLA 2010-11-05 14:20:27 EDT
(In reply to comment #6)
> We need at least the stack trace that led to this dialog.

There was nothing in the error log
Comment 8 Olivier Thomann CLA 2010-11-05 14:44:46 EDT
(In reply to comment #5)
> Not reproducible. I can provide configuration dump. In any case the logic
> should be evaluated: a bug/exception thrown by JDT should not prevent a save.
Right, but to investigate I need to reproduce what happened. I don't even know what operation failed.
Comment 9 John Peberdy CLA 2010-11-09 13:25:19 EST
(In reply to comment #8)
> (In reply to comment #5)
> > Not reproducible. I can provide configuration dump. In any case the logic
> > should be evaluated: a bug/exception thrown by JDT should not prevent a save.
> Right, but to investigate I need to reproduce what happened. I don't even know
> what operation failed.
Ok. Feel free to close then. This can be documentation in case this issue comes up in the future. Otherwise forward to core Eclipse: Eclipse should not let a bug in a plugin prevent a save.
Comment 10 Veijo Ryhänen CLA 2011-11-18 05:17:49 EST
Created attachment 207211 [details]
Erros message screenshot

I can reproduce this bug:

1. I open external SameName.java file ("File" -> "Open file..."), which is originally UTF-8, but eclipse wrongly converted it to default encoding CP-1252 -> skandinavian special alphabetic characters looks therefore very ugly, like this: näyttö  (there should be: näyttö). 
Therefore I call this file "ugly looking" SameName.java

2. Then I copy-paste two text row (which includes only american letters) from "ugly looking" SameName.java to my other, "nice looking" SameName.java file (which came from CVS import and which name is SameName.java too, but it shows skandinavian alphabets correctly). 

3. Then I try to save my "nice looking" SameName.java (which came from cvs) and then I get:

"Save could not be completed.

Reason:
Operation not supported for specified element type(s):SameName.java[in <default> [in (package path is here)[in (project name is here)]]]"
Comment 11 Veijo Ryhänen CLA 2011-11-18 05:30:42 EST
My eclipse is:

Version: Helios Service Release 2
Build id: 20110218-0911
Comment 12 Jay Arthanareeswaran CLA 2011-11-18 05:44:18 EST
(In reply to comment #10)
> Created attachment 207211 [details]
> Erros message screenshot
> 
> I can reproduce this bug:

I can't reproduce this on HEAD or 3.8 M3. Only difference is, I didn't use CVS
and I used eclipse to create the UTF-8 encoded file as well as the other one
with Cp1252 encoding. And I had both files open in eclipse and copied from one
editor to another. Hope this is in line with your steps.

Anything in the logs this time?
Comment 13 Veijo Ryhänen CLA 2011-11-18 07:23:33 EST
There was nothing (new) texts in "Console" window after errow window appeared.

I did: "Help" -> "Check for updates" (waiting...)-> "Select components for update" (or something like that) -> "You must restart your eclipse"

And now I still have:

Version: Helios Service Release 2
Build id: 20110218-0911

But I am sure that eclipse did several updates, but did not raise version number. I can find some minor updates here:

>cd D:\eclipse\configuration\org.eclipse.update\history

>dir
05.05.2011  08:34            29 968 1304577269528.xml
18.11.2011  13:45            29 718 1321616750447.xml

>diff 1304577269528.xml 1321616750447.xml |wc
    528    1704   57902

Anyway, I cant produce this bug anymore after updating my eclipse, so for me this bug is now "Resolved Fixed" !

Thank you for making new eclipse versions! :-)
Comment 14 Jay Arthanareeswaran CLA 2011-11-18 09:47:48 EST
Marking as resolved.
Comment 15 Stephan Herrmann CLA 2011-12-06 07:28:42 EST
I was just looking at this when I saw it is already marked VERIFIED.

Anyway, here's my 2c:

Original reporter gave very few details, so we had no chance to actually
reproduce. Still we could guess a *little* more from the report:
The message corresponds to a Status with detail
IJavaModelStatusConstants.INVALID_ELEMENT_TYPES.
I would guess that this was likely raised in 
org.eclipse.jdt.internal.core.CommitWorkingCopyOperation.verify()
which *would* mean an attempt was made to commit a non-workingcopy CU.
Would this happen, when trying to save a non-dirty buffer?

Anyway, we won't get much closer without a stacktrace or s.t. like it.


As to the second reporter:

(In reply to comment #13)
> There was nothing (new) texts in "Console" window after errow window appeared.

We should have explicitly asked to open the "Error Log" view instead of 
looking at some console (which? Eclipse Console? Windows Console?).


Finally, with

> Anyway, I cant produce this bug anymore after updating my eclipse, so for me
> this bug is now "Resolved Fixed" !

I agree with the resolution of this bug.