[
https://issues.apache.org/jira/browse/JCR-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470952
]
Iaacov Rosenberg commented on JCR-736:
--------------------------------------
Here's the problem and the suggested fix:
The source of the problem is in JCAManagedConnectionFactory#openSession:
/**
* Create a new session.
*/
private XASession openSession(JCAConnectionRequestInfo cri)
throws ResourceException {
createRepository();
Credentials creds = cri.getCredentials();
String workspace = cri.getWorkspace();
try {
XASession session = (XASession) getRepository().login(creds,
workspace);
log("Created session (" + session + ")");
return session;
} catch (RepositoryException e) {
log("Failed to create session", e);
throw new ResourceException(
"Failed to create session: " + e.getMessage());
}
}
All login() exceptions which are instanceOf RepositoryException are catched and
rethrown as ResourceException. That's fine because we are being called by an AS
(application server) which doesn't know about repositories.
However, just for these situations, JCARepositoryHandle#login checks for the
exception's cause, which is missing.
Therefore, the correct catch clause should be as following:
} catch (RepositoryException e) {
log("Failed to create session", e);
throw new ResourceException(
"Failed to create session: " + e.getMessage(), e); <--
added second argument
}
> Wrong exeption returned from Repository.login(Credentials, String)
> ------------------------------------------------------------------
>
> Key: JCR-736
> URL: https://issues.apache.org/jira/browse/JCR-736
> Project: Jackrabbit
> Issue Type: Bug
> Components: jca
> Affects Versions: 1.2.1
> Environment: JRE 1.5.0_10, JBoss 4.0.5 GA, JBossWS 1.0.4 GA, WinXP SP2
> Reporter: Iaacov Rosenberg
> Assigned To: Jukka Zitting
>
> According to specification, calling Repository.login(Credentials, String)
> with a non-existent wokspaceName should return NoSuchWorkspaceException.
> In fact it returns RepositoryException.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.