Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353249 - CDOTransaction/CDOView getResourceNode does not return null
Summary: CDOTransaction/CDOView getResourceNode does not return null
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-27 15:00 EDT by kaab CLA
Modified: 2012-09-21 07:18 EDT (History)
0 users

See Also:


Attachments
Very small test showing the issue (765 bytes, text/x-java)
2011-07-27 15:02 EDT, kaab CLA
no flags Details
Fix (2.86 KB, patch)
2011-07-28 00:07 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kaab CLA 2011-07-27 15:00:40 EDT
Build Identifier:  I20110613-1736

+ In the Javadocs for getResourceNode it says "Returns the resource node with the given path, or null if no such resource node exists."
+ When I try to retrieve a resource node that doesn't exist I will get an exception "org.eclipse.emf.cdo.common.util.CDOException: No top level ResourceNode with the name xxxx"
+ Javadocs should be updated or the implementation should modified to correspond to the documentation, in this case my personal opinion is that it makes sense to return null if the node doesn't exist.

Reproducible: Always

Steps to Reproduce:
1. Run the unit test, expected result should be for the test to pass, instead it will throw an exception.
Comment 1 kaab CLA 2011-07-27 15:02:16 EDT
Created attachment 200467 [details]
Very small test showing the issue
Comment 2 Eike Stepper CLA 2011-07-28 00:07:05 EDT
Your test case is not correct, you're calling getResource(), not getResourceNode(). I could however reproduce the underlying issue you describe. Because a bunch of other methods and possibly existing user code relies on the current behaviour I decided to change the JavaDoc. In addition I explicitely check for null now and turn that into an additional exception. Thanks for pointing this out!

The new test case is in ResourceTest.testGetResourceNodeContract().
Comment 3 Eike Stepper CLA 2011-07-28 00:07:34 EDT
Created attachment 200487 [details]
Fix
Comment 4 Eike Stepper CLA 2011-07-28 00:08:57 EDT
Will fix this in trunk first and then port to maintenance.
Comment 5 Eike Stepper CLA 2011-07-28 00:09:32 EDT
Maintenance: bug 353275.
Comment 6 Eike Stepper CLA 2011-07-28 00:19:08 EDT
Committed revision 8834:
- trunk/plugins/org.eclipse.emf.cdo
- trunk/plugins/org.eclipse.emf.cdo.tests
Comment 7 Eike Stepper CLA 2011-07-28 00:19:21 EDT
Resolved.
Comment 8 Eike Stepper CLA 2012-09-21 07:18:31 EDT
Closing.