Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325108

Summary: Java Discoverer : DanglingHREFException with a block comment construct
Product: [Modeling] MoDisco Reporter: Fabien Giquel <fabien.giquel>
Component: TechnologiesAssignee: Nicolas Bros <nicolas.bros>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: gdupe, hugo.bruneliere, modisco.web-inbox, nicolas.bros
Version: 0.9.0Flags: gdupe: indigo+
Target Milestone: 0.9.0 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Related code
none
Stack trace
none
patch none

Description Fabien Giquel CLA 2010-09-13 08:29:41 EDT
Created attachment 178738 [details]
Related code

Applying the Java discoverer on attached class source leads up to a non attached EObject exception when saving to XMI.
Comment 1 Fabien Giquel CLA 2010-09-13 08:30:05 EDT
Created attachment 178739 [details]
Stack trace
Comment 2 Fabien Giquel CLA 2010-10-04 12:31:22 EDT
A similar issue with javadoc occurs when invoking "java discoverer" on MoDisco "oegm.java.discoverer" sources project.
Comment 3 Gregoire Dupe CLA 2010-10-06 10:09:25 EDT
Moving to P1 because this blocks the java discoverer usage.
Comment 4 Nicolas Bros CLA 2010-10-18 06:43:35 EDT
I think I have found the reason for this bug.

The comment is attached to an element, but then later removed by this statement in CommentsManager#jdtLocationSearch:

 // we have to clear javadoc comments that have been already
 // linked to the element
 element.getComments().clear();

I don't understand the reason for this statement. Could someone with more knowledge on the Java discoverer investigate this?
Comment 5 Nicolas Bros CLA 2010-10-18 08:33:51 EDT
Created attachment 181088 [details]
patch

Anyway, here is a patch that fixes the problem, by removing only javadoc
comments as the comment suggests, and putting back removed comments in the
unhandled comments list.
Comment 6 Fabien Giquel CLA 2010-10-18 10:03:05 EDT
Looking back to the code, i remember that javadoc instances are already attached in JdtVisitor to elements before CommentsManager invocation, and i understand that they may need some relocalization -> remove from elements and putting them in localCommentList seems logical.
I agree with the patch.
Comment 7 Nicolas Bros CLA 2010-10-18 10:27:12 EDT
Thank you for your review.

I committed the patch in revision 3333.
Comment 8 Nicolas Bros CLA 2010-10-19 04:19:58 EDT
A test failed with this modification. I removed the "localCommentList.add(javadoc);" and it passes all the tests.

I also added a test for this bug.
Comment 9 Hugo Bruneliere CLA 2010-10-21 05:11:57 EDT
The patch has been successfully integrated.