X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=jcr%2Forg.argeo.cms.jcr%2Fsrc%2Forg%2Fargeo%2Fcms%2Fjcr%2Finternal%2FEgoRepository.java;h=abf1a641802fe7f04d3f47d412b3a8145c34369f;hb=dca2b13e0e3ca3e7a9469e089b980c48c880ad1a;hp=29802509617bcc0545f4db86596dee380c491046;hpb=4e8d82137c2dce7145175eacbd225a52227b6f73;p=lgpl%2Fargeo-commons.git diff --git a/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/internal/EgoRepository.java b/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/internal/EgoRepository.java index 298025096..abf1a6418 100644 --- a/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/internal/EgoRepository.java +++ b/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/internal/EgoRepository.java @@ -19,7 +19,6 @@ import javax.security.auth.login.LoginContext; import org.argeo.api.cms.CmsAuth; import org.argeo.api.cms.CmsConstants; -import org.argeo.cms.CmsException; import org.argeo.cms.jcr.CmsJcrUtils; import org.argeo.jcr.JcrException; import org.argeo.jcr.JcrRepositoryWrapper; @@ -28,7 +27,7 @@ import org.argeo.jcr.JcrUtils; /** * Make sure each user has a home directory available. */ -class EgoRepository extends JcrRepositoryWrapper implements KernelConstants { +class EgoRepository extends JcrRepositoryWrapper { /** The home base path. */ // private String homeBasePath = KernelConstants.DEFAULT_HOME_BASE_PATH; @@ -145,7 +144,7 @@ class EgoRepository extends JcrRepositoryWrapper implements KernelConstants { // JcrUtils.addPrivilege(adminSession, groupsBasePath, NodeConstants.ROLE_USER_ADMIN, Privilege.JCR_READ); adminSession.save(); } catch (RepositoryException e) { - throw new CmsException("Cannot initialize home repository", e); + throw new JcrException("Cannot initialize home repository", e); } finally { JcrUtils.logoutQuietly(adminSession); } @@ -197,7 +196,7 @@ class EgoRepository extends JcrRepositoryWrapper implements KernelConstants { try { dn = new LdapName(username); } catch (InvalidNameException e) { - throw new CmsException("Invalid name " + username, e); + throw new IllegalArgumentException("Invalid name " + username, e); } String userId = dn.getRdn(dn.size() - 1).getValue().toString(); return '/' + userId; @@ -214,7 +213,7 @@ class EgoRepository extends JcrRepositoryWrapper implements KernelConstants { try { dn = new LdapName(username); } catch (InvalidNameException e) { - throw new CmsException("Invalid name " + username, e); + throw new IllegalArgumentException("Invalid name " + username, e); } String userId = dn.getRdn(dn.size() - 1).getValue().toString(); return userId; @@ -233,7 +232,7 @@ class EgoRepository extends JcrRepositoryWrapper implements KernelConstants { Node newWorkgroup = CmsJcrUtils.getGroupHome(adminSession, cn); if (newWorkgroup != null) { JcrUtils.logoutQuietly(adminSession); - throw new CmsException("Workgroup " + newWorkgroup + " already exists for " + dn); + throw new IllegalStateException("Workgroup " + newWorkgroup + " already exists for " + dn); } try { // TODO enhance transformation of cn to a valid node name @@ -251,7 +250,7 @@ class EgoRepository extends JcrRepositoryWrapper implements KernelConstants { JcrUtils.addPrivilege(adminSession, newWorkgroup.getPath(), dn.toString(), Privilege.JCR_ALL); adminSession.save(); } catch (RepositoryException e) { - throw new CmsException("Cannot create workgroup", e); + throw new JcrException("Cannot create workgroup", e); } finally { JcrUtils.logoutQuietly(adminSession); }