Bug 75814 - Inconsistent results when adding a breakpoint to class file with src attached
Summary: Inconsistent results when adding a breakpoint to class file with src attached
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.2   Edit
Hardware: PC Windows 2000
: P2 critical (vote)
Target Milestone: 2.1.3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-07 11:59 EDT by Troy Bishop CLA
Modified: 2005-05-24 11:05 EDT (History)
4 users (show)

See Also:


Attachments
JAR file without source. (1.24 KB, application/octet-stream)
2004-11-01 11:24 EST, Troy Bishop CLA
no flags Details
source jar file. (1000 bytes, application/octet-stream)
2004-11-01 11:24 EST, Troy Bishop CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Troy Bishop CLA 2004-10-07 11:59:19 EDT
I have two different machines both with the same version of WSAD v5.1.2 (Eclipse
v2.1.3) installed using the same J9 JVM build (20040510)... On one machine I can
add/remove breakpoints without any problems from a class file that is contained
in a JAR that has the source attached; However, on another machine with the same
installation image the breakpoint image in the Java editor is not displayed when
the breakpoint is added and the menu options for the breakpoint do not work
afterwards.  The breakpoint is added as I can see it in the 'breakpoint' view. 
I ran WSAD with -verbose:class and found the following:

On the machine where the breakpoint fails to show the image in the Java editor
the following happens:

class load:
org/eclipse/jdt/internal/debug/ui/snippeteditor/ISnippetStateChangedListener
class load: org/eclipse/jdt/internal/debug/ui/actions/EvaluateAction
class load: org/eclipse/jdt/internal/debug/ui/actions/ExecuteAction
class load: org/eclipse/jdt/internal/debug/ui/display/IDataDisplay
class load: org/eclipse/jdt/internal/debug/ui/actions/DisplayAction
class load: org/eclipse/jdt/internal/debug/ui/actions/InspectAction
class load: org/eclipse/jdt/internal/debug/ui/actions/WatchAction
class load: org/eclipse/ui/internal/PagePartSelectionTracker$1
class load: org/eclipse/ui/internal/PagePartSelectionTracker$2
[end]

On the machine where the breakpoint does show up the following happens:

class load:
org/eclipse/jdt/internal/debug/ui/snippeteditor/ISnippetStateChangedListener
class load: org/eclipse/jdt/internal/debug/ui/actions/EvaluateAction
class load: org/eclipse/jdt/internal/debug/ui/actions/ExecuteAction
class load: org/eclipse/jdt/internal/debug/ui/display/IDataDisplay
class load: org/eclipse/jdt/internal/debug/ui/actions/DisplayAction
class load: org/eclipse/jdt/internal/debug/ui/actions/InspectAction
class load: org/eclipse/jdt/internal/debug/ui/actions/WatchAction
class load: org/eclipse/ui/IWorkbenchPage[]
class load: org/eclipse/ui/internal/PagePartSelectionTracker$1
class load: org/eclipse/ui/internal/PagePartSelectionTracker$2
class load: org/eclipse/ui/internal/registry/MarkerImageProviderRegistry
class load:
org/eclipse/ui/internal/registry/MarkerImageProviderRegistry$1$MarkerImageReader
class load: org/eclipse/ui/internal/registry/MarkerImageProviderRegistry$Descriptor
class load: org/eclipse/debug/internal/ui/DebugPluginImages
class load: org/eclipse/jdt/internal/debug/ui/ImageDescriptorRegistry
class load: org/eclipse/jdt/internal/debug/ui/ImageDescriptorRegistry$1
class load: org/eclipse/jdt/internal/debug/ui/JavaDebugHover
class load: org/eclipse/debug/core/model/IDebugTarget[]
[end]

I can understand if you will be unable to reproduce this so I was wondering if
there is anything else that I can provide which may help to get to the bottom of
why this is happening?  I tried this with Eclipse v3.0 as well (not 3.0.1) and
the results were the same.
Comment 1 Dirk Baeumer CLA 2004-10-07 13:05:48 EDT
Troy, is there anything in the .log file ?
Comment 2 Troy Bishop CLA 2004-10-07 13:15:45 EDT
No, there is nothing in the .log file.
Comment 3 Dirk Baeumer CLA 2004-10-08 04:44:00 EDT
Moving to Text since the breakpoint is present in the break point view, but 
not in the editor.
Comment 4 Dani Megert CLA 2004-10-08 04:56:47 EDT
Does the debugger stop at the breakpoint?
Do you set the breakpoint at exact the same location on both machines?
Do you maybe see bug 35081?
Comment 5 Troy Bishop CLA 2004-10-08 10:05:34 EDT
Yes, the debugger will definitly stop at the breakpoint.  That's the main reason
for opening this defect as the end-user is left wondering why the debugger has
stopped when there is no breakpoint marker visible in the editor.

Yes, the breakpoint was set at the same location on both machines.

The code in the JAR file was the following:

public class HelloLib {

	public String sayHello(String name) {

		return "Hello " + name + "!";
	}
}

I put the breakpoint on the 'return "Hello " + name + "!";' statement, so I
don't think this is similar to bug 35081.
Comment 6 Dani Megert CLA 2004-10-12 03:38:33 EDT
- Are both machines running Windows2000?
- Is it exactly the same JAR?
- Is the same source attached?
- Is the project's build path setup identically?
- When you tried Eclipse R3.0 did you use a new workspace? If not can you try with
  a new workspace? Also, if not, can you try to copy the workspace from the 
  working machine to the one where it's not working and try whether you now see 
  the breakpoint.
Comment 7 Troy Bishop CLA 2004-10-12 11:35:11 EDT
1) Yes, both machines are running Windows 2000 SP4.
2) Yes, it is exactly the same JAR (I just copied it from one machine to the other).
3) Yes, the same source JAR file is attached (same answer as #2).
4) The projects build path is the same (whatever the defaults are + the external
JAR file being added).
5) Yes, I tried new workspaces when I tested in v3.0 (and v3.0.1). I tried
copying over the workspace from the 'good' computer to the 'bad' computer and I
am able to toggle the breakpoint successfully now.  This is where the strange
occurrences start happening...

If I create a new workspace and Java project on the 'bad' computer (the one
where setting the breakpoint fails) and use the original JAR files then I am
able to reproduce the problem.  However, if I then create another project (in
the same workspace) using the JAR files that were copied to the 'good' computer
(the one where setting the breakpoint is successful) and then copied back (via
the workspace in (5) above) to the 'bad' computer then the problem does not
occur... yet the JAR files are the same (the binary and source JAR files have
the same size and timestamp as the original ones and none of them are
corrupted).  I also tried this separate in a new workspace and the result is the
same.  I can attach both sets of JAR files if you would like to try it out yourself.
Comment 8 Dani Megert CLA 2004-10-12 11:41:20 EDT
Can you check in "good" and "bad" workspace
a) which JRE is the default
b) which JRE is on the project's Java build path
Comment 9 Troy Bishop CLA 2004-10-12 11:56:06 EDT
the good computer JRE (shipped with WebSphere Application Server v5.1.1):

java.version=1.4.2
java.vm.info=J2RE 1.4.2 IBM J9 build 20040610 (JIT enabled)
java.vm.name=IBM J9SE VM

* There is only 1 Installed JRE (called 'java') so it is, of course, the default
and is the 'JRE System Library' on the build path for the Java project.

---

the bad computer JRE (shipped with WebSphere Application Server v5.1.1):

java.version=1.4.2
java.vm.info=J2RE 1.4.2 IBM J9 build 20040610 (JIT enabled)
java.vm.name=IBM J9SE VM

* There is only 1 Installed JRE (called 'java') so it is, of course, the default
and is the 'JRE System Library' on the build path for the Java project.

---

I've also tried this on the Sun v1.4.2 and v1.5 JRE's as well and it is
reproducible with it under the same scenarios as mentioned above.
Comment 10 Dani Megert CLA 2004-11-01 05:05:44 EST
Any additional insights from the Debug team?
Comment 11 Darin Wright CLA 2004-11-01 09:52:41 EST
In the "bad" scenario, does the Java editor have a vertical ruler?
Comment 12 Troy Bishop CLA 2004-11-01 10:27:21 EST
Yes, the editor has a vertical ruler.
Comment 13 Darin Wright CLA 2004-11-01 10:30:24 EST
Please attach the jar files, or project export that demonstrates the problem, 
and tell us where to set the breakpoint.
Comment 14 Troy Bishop CLA 2004-11-01 11:24:31 EST
Created attachment 15519 [details]
JAR file without source.
Comment 15 Troy Bishop CLA 2004-11-01 11:24:51 EST
Created attachment 15520 [details]
source jar file.
Comment 16 Troy Bishop CLA 2004-11-01 11:30:26 EST
Attached is a JAR file (HelloLib.jar) and it's source code in a separate JAR
(HelloLib-src.jar).  I could reproduce the problem by creating an empty Java
project, adding the HelloLib.jar to the classpath, attaching the source to it,
and then trying to add a breakpoint to return statement in the sayHello() method.
Comment 17 Darin Wright CLA 2004-11-16 16:15:40 EST
I can't reproduce this with the attached example - the breakpoint appears as 
expected.
Comment 18 Troy Bishop CLA 2004-11-16 16:25:51 EST
I figured that would happen as I can only reproduce it on one of my machines
here... so that's why I was wondering if there is any additional traces,
information, etc. that I could provide you so that you may be able to take a 
guess as to what's causing it.

Would it help if I created a remote desktop session on my machine for you to
login and do whatever testing you need?
Comment 19 Darin Wright CLA 2004-11-16 16:33:31 EST
Can you see if the problem occurrs on 3.0? If not, I'd prefer not to invest 
too many cycles into the investigation.
Comment 20 Troy Bishop CLA 2004-11-16 16:36:11 EST
Yes, I can reproduce this problem in Eclipse v3.0 (haven't tried v3.0.1 though).
 The situation is the same as with v2.1.3 - it works fine on one machine but not
the other.
Comment 21 Darin Wright CLA 2004-11-16 17:48:04 EST
I can reproduce the problem by placing the HelloLib.jar in the root directory 
in the file system. The problem appears to be that java element handles are 
not restored to be the same element when the jar is in the root directory. 
When the classfile is asked for its handle when creating the ATT_HANDLE_ID 
memento in #addJavaElementMarkerAttributes(...), the folllowing is returned:

=HW/C:\/HelloLib.jar<com.test(HelloLib.class

The original element is as follows:

HelloLib.class [in com.test [in C:\HelloLib.jar [in HW]]]
  class HelloLib

When restoring from the memento, the element returned is:

HelloLib.class (not open) [in com.test [in <project root> [in HW]]]

Notice that the element created is in the project root rather than the 
external jar. Moving to JCORE for investigation.
Comment 22 Darin Wright CLA 2004-11-16 17:48:30 EST
(NOTE, this happens on 3.0, but I did not verify it happens in 3.1)
Comment 23 Philipe Mulet CLA 2004-11-16 18:26:53 EST
Fix should be backported to 2.1 maintenance stream (once available), and patch
posted.
Comment 24 Jerome Lanneluc CLA 2004-11-17 02:11:45 EST
In 2_1_maintenance stream, changed JavaProject#getPackageFragmentRoot(IPath) to
handle the case where the segment count is 1 but the path is different from the
project path. Added regression test MementoTests#testExternalJarClassFileMemento()
Comment 25 Jerome Lanneluc CLA 2004-11-17 02:13:23 EST
Troy, you can find a patch at
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-home/r2.1/main.html#updates
Comment 26 Troy Bishop CLA 2004-11-17 09:58:44 EST
Thank you very much for the patch - it has resolved this problem for the v2.1.3
release.
Comment 27 Jerome Lanneluc CLA 2004-11-17 10:54:18 EST
Thanks for letting us no that it solves the problem.
Comment 28 Jerome Lanneluc CLA 2004-11-17 12:04:20 EST
Released fix and test to HEAD and 3.0.x streams.
Comment 29 Philipe Mulet CLA 2005-01-26 16:08:50 EST
Tagging as candidate for 3.0.2, since it went to a 2.0 maintenance as well.
Once verified in 3.0.2, target milestone should be reverted to 2.1.3 to reflect
earliest delivery.
Comment 30 Frederic Fusier CLA 2005-03-10 06:21:13 EST
Verified for 3.0.2 for build M200502161722.
Put target back to 2.1.3
Comment 31 Troy Bishop CLA 2005-05-24 11:05:01 EDT
Thanks!