Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325108 - Java Discoverer : DanglingHREFException with a block comment construct
Summary: Java Discoverer : DanglingHREFException with a block comment construct
Status: CLOSED FIXED
Alias: None
Product: MoDisco
Classification: Modeling
Component: Technologies (show other bugs)
Version: 0.9.0   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: 0.9.0 M3   Edit
Assignee: Nicolas Bros CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-13 08:29 EDT by Fabien Giquel CLA
Modified: 2010-10-21 05:11 EDT (History)
4 users (show)

See Also:
gdupe: indigo+


Attachments
Related code (167 bytes, text/x-java)
2010-09-13 08:29 EDT, Fabien Giquel CLA
no flags Details
Stack trace (2.87 KB, text/plain)
2010-09-13 08:30 EDT, Fabien Giquel CLA
no flags Details
patch (1.63 KB, patch)
2010-10-18 08:33 EDT, Nicolas Bros CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.