@Override
public synchronized Repository getRepository() throws RepositoryStubException {
Repository repository = JCRSessionFactory.getInstance();
if (repository == null) {
throw new RepositoryStubException("Failed to start repository");
} else {
try {
Session session = JCRSessionFactory.getInstance().getCurrentUserSession();
try {
if (!isTestWorkspacePrepared(session)) {
prepareTestContent(session);
}
} finally {
}
} catch (Exception e) {
RepositoryStubException exception = new RepositoryStubException(
"Failed to start repository");
exception.initCause(e);
throw exception;
} finally {
//JCRSessionFactory.getInstance().setCurrentUser(null);
}
}