On 25.04.2014, at 00:21, Carsten Ziegeler <[email protected]> wrote:

> The documentation of clone clearly states that if "null" is passed in: "the
> same credential data is used as was used to create this instance." which in
> turn means, if the initlal resolver was created based on a session, this
> one will share the session.

There are a few problems with this:
- seeing the session object itself as "credential data" is unintuitive
- in my code, I have no idea what the original credential data was, so I don't 
know what kind of credential data it was to make the right decision
- since sharing a JCR session is to be avoided at all times, the resource 
resolver should prevent one from this

Are there any cases where you want a cloned resolver to share the session?

> So in your case, you have to create a new session and pass this into the
> clone method - or you can also call the resource resolver factory directly.

Which is A LOT of boilerplate given there already is a clone() method. It is 
not so much if using the USER_IMPERSONATION, but still, clone(null) would be 
great to reflect a session clone = impersonate itself.

Cheers,
Alex

Reply via email to