Bug 20153 - Export into JAR incorrectly references old description file.
Summary: Export into JAR incorrectly references old description file.
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-13 09:22 EDT by Andreas Krüger CLA
Modified: 2002-08-22 09:44 EDT (History)
1 user (show)

See Also:


Attachments
Caught after all! It was the manifest! Explanation follows. (15.97 KB, image/png)
2002-06-14 11:50 EDT, Andreas Krüger CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Krüger CLA 2002-06-13 09:22:04 EDT
Yesterday, I exported some .class - files from one project into a JAR.  I asked
that export's JAR description to be saved into some file.

Today, I do a completely unrelated export of .java - files from two projects
into one JAR, including files from the same project.  I don't want to save this
JAR description, so I leave the option "Save the description of this JAR in the
workspace." as "off".  Towards the end of the export, I'm asked wether I want to
overwrite that JAR description file I had yesterday.  There has not been any
previous visual clue towards that description file name anywhere in the JAR
export wizard.

As I had wanted to do this anyway, I upgrade from F2 to F3.  Under F3, I repeat
the .java export same workspace.  Again, I'm asked wether I want to overwrite
yesterdays JAR description file.

I start one more JAR export.  This time, I click "Save the description of this
JAR in the workspace." to "on" and immediately to "off" again.  That finally
helps: No mention of yesterday's JAR description file any more.

Allthough I think I have told eclipse _not_ to overwrite that file, every single
time eclipsed asked me, it's contents have indeed been changed.  I can revert to
yesterday's version through "local history".
Comment 1 Dirk Baeumer CLA 2002-06-14 11:26:41 EDT
I tried to reproduce it but was able. Did the following:

- create project Test with a CU
- exported it to c:\tmp\test.jar saving jardesc under Test\test.jardesc
- create project Test2 with a CU
- open export to Jar
- unchecked Save the description ...
- pressed Finish

observe: the systems asks you if you want to override c:\tmp\test.jar since I 
didn't change the location of the jar when exporting Test2. The Save the 
description... option works as expected. 

Are you sure the system didn't ask you to override the jar file ?

Comment 2 Andreas Krüger CLA 2002-06-14 11:34:46 EDT
As a quick answer: I'm positive it wasn't asking me about the .jar file itself.

But it could possibly be that what it did ask me was the manifest file of the
previous export, which I had asked to be saved.

As this export was a source code export only, I wasn't asked about the
generation of a manifest this time.

I'm trying to reproduce, so I can tell you more.
Comment 3 Andreas Krüger CLA 2002-06-14 11:40:18 EDT
Sorry, I can't reproduce this with F3. I'm afraid I have to leave you alone with
what little information is in this bug report already.  If you wish, settle this
as "Resolve/Worksforme".  If you do, I'll resurrect if I ever catch this again.
Comment 4 Andreas Krüger CLA 2002-06-14 11:50:31 EDT
Created attachment 1417 [details]
Caught after all! It was the manifest! Explanation follows.
Comment 5 Andreas Krüger CLA 2002-06-14 12:10:20 EDT
Excuse me.  For a moment, I thought I did reproduce the bug, or at least
something very close to it.  But this time, it was only my own mistake.
I got exactly what I had asked for.

I was confused.

Back to the original problem.  I distinctly remember that my problems
immediately went away when I quickly clicked "Save the description of this JAR
in the workspace." to "on" and immediately to "off" again.

That left the GUI in exactly the same visible state as it had been before, but
somehow changed something internally, and thus got rid of the problem.  It's
that clear rememberence that tells me that it can't be my confusion only, but
some Eclipse bug substance must also hide here somewhere.

I appreciate that this entire bug page must not be overly clear for you, and
does not make it easy to see what it is that's going on.  I apologize for that fact.

All of this said, I must confess to still more confusion on my part:

I tend to think of a "manifest file" as the thing that *describes* a JAR archive.

So, at the time when the original bug happened, I was not aware of the
difference between what everybody calls a manifest file and what Eclipse calls a
"JAR description file".  (You may want to make that clearer in the GUI, call it
"JAR export recipe" instead, if you wish.)

Come to think of it, could I have entered the same file name for the manifest
file and for the JAR description file, on that primary export that started this
entire mess?  What would Eclipse think of that?

Comment 6 Andreas Krüger CLA 2002-06-14 12:20:44 EDT
No, wait.  Back to the screen shot.  I finally did catch something.  There is a
mistake, but that mistake is one level below, in the window you see below.

I tell eclipse "I don't really care about that manifest file.  Just generate one
for me and forget about it afterwards."

That checkmark "Reuse and save" is gray, I cannot uncheck it.  I also cannot
change the name of the file.

But when I do the export, Eclipse tells me it's about to overwrite that manifest
file, a fact that I could not change via the GUI a moment ago, and to a location
I could not change a moment ago.  This is clearly a bug in the GUI.

My intention is to have the manifest file be autogenerated and never see it
again.  This intention I cannot pass on through the GUI.  The GUI forces me to
save the newly generated manifest to the workspace, wether I wish to do so or not.
Comment 7 Dani Megert CLA 2002-07-18 11:34:33 EDT
The bug is that the manifest is generated at all. Note that the manifest is even
written if you only export source.

You could have changed the name by checking
[x] Save the manifest in the workspace
The reuse option comes as addition to saving.
Comment 8 Dani Megert CLA 2002-07-18 11:37:05 EDT
This is even a 2.0.1 candidate.
Comment 9 Dani Megert CLA 2002-07-22 10:35:09 EDT
Fixed.
Available in 2.1 builds > 20020722

Waiting for permission to release to 2.0.1
Comment 10 Dirk Baeumer CLA 2002-07-22 13:17:06 EDT
Daniel, can you please describes the disadvantages of not fixing this for 
2.0.1. 
Comment 11 Dani Megert CLA 2002-07-23 02:40:52 EDT
The concrete problem is:
1. Choose to export class files with the JAR Exporter and also choose to save
the generated manifest file.
2. Do a second export with only Java files and resources (no class files)
=> the manifest is generated and written even though it makes no sense (the
wizard page is not available)

Not fixing this for 2.0.1 means:
1) The existing manifest file gets overwritten with bogus data without user
notification if the "overwrite exisiting files" is checked (=> work is lost)
2) The user can't control the behavior (e.g. filename) unless he chooses to
export to class files (this enables the manifest page in the wizard)

Fix would be easy and is already tested in 2.1:
change:
  // Save the manifest
  if (fJarPackage.isManifestGenerated() && fJarPackage.isManifestSaved()) {
to:
  // Save the manifest
  if (fJarPackage.areClassFilesExported() &&
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      fJarPackage.isManifestGenerated() && fJarPackage.isManifestSaved()) {
Comment 12 Dani Megert CLA 2002-07-23 09:30:31 EDT
2.0.1 candidate
Comment 13 Dani Megert CLA 2002-07-25 03:04:16 EDT
Closing this PR - not critical enough to be fixed in 2.0.1
Comment 14 Andreas Krüger CLA 2002-07-30 09:18:41 EDT
You did not fix this, you just think it's not a big deal.

Should not this be marked "resolved later" rather than "resolved fixed"?

(I take the liberty of reopening it.)
Comment 15 Andreas Krüger CLA 2002-07-30 09:20:03 EDT
No, oops - now I see: It *is* fixed, but in 2.1 only, not already in 2.0.1.
Sorry for the noise.  I'll "fix" it again.
Comment 16 Dani Megert CLA 2002-08-07 07:01:43 EDT
Bug got OK to be fixed in R2.0.1
Released to R2_0_1 branch.


Comment 17 Dirk Baeumer CLA 2002-08-22 09:44:11 EDT
verified on build 200208211513