Hi Christian, christian (JIRA) schrieb: > JcrResourceResolver2 resolve(String) method not API conform > ----------------------------------------------------------- > > Key: SLING-752 > URL: https://issues.apache.org/jira/browse/SLING-752 > Project: Sling > Issue Type: Bug > Components: JCR > Affects Versions: JCR Resource 2.0.4 > Reporter: christian > Priority: Minor > > > Affected is the JcrResourceResolver2#resolve(abspath) method. > > If abspath argument doesn't point to an Item, the resolver returns a > Resource of type non-existing. > The API according its JAVA-Doc requires to return <null> in this case >
Thanks for pointing this out. According to the current (and previous) implementation and expectations, this JavaDoc is wrong and the JavaDoc of the other resolve methods is incomplete and does not reflect intentions. The intentions are, that the resolve methods never return null but instead return a NonExistingResource if the path cannot resolve to a resource. This contrasts with the getResource methods, which in fact will return null if a resource cannot be found (and hence never return a NonExistingResource). So the solution to this problem would be update the JavaDoc to something like: "@return The resource addressed by the path or NonExistingResource if no resource can be resolved". WDYT ? Regards Felix
