X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.jcr%2Fsrc%2Forg%2Fargeo%2Fjcr%2FThreadBoundJcrSessionFactory.java;h=1e23338b54660816148c68f546e5594958d01fb5;hb=8e5934c1ff5587a5156854839210cc93bb66fc41;hp=cc6ef26f623ed8a12cd8709b054d531a03e39544;hpb=71196c25959b53964edf87aeb4387ed8b11b4868;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.jcr/src/org/argeo/jcr/ThreadBoundJcrSessionFactory.java b/org.argeo.jcr/src/org/argeo/jcr/ThreadBoundJcrSessionFactory.java index cc6ef26f6..1e23338b5 100644 --- a/org.argeo.jcr/src/org/argeo/jcr/ThreadBoundJcrSessionFactory.java +++ b/org.argeo.jcr/src/org/argeo/jcr/ThreadBoundJcrSessionFactory.java @@ -54,7 +54,7 @@ public abstract class ThreadBoundJcrSessionFactory { /** Logs in to the repository using various strategies. */ protected synchronized Session login() { if (!isActive()) - throw new ArgeoJcrException("Thread bound session factory inactive"); + throw new IllegalStateException("Thread bound session factory inactive"); // discard session previously attached to this thread Thread thread = Thread.currentThread(); @@ -76,7 +76,7 @@ public abstract class ThreadBoundJcrSessionFactory { // invalid credentials, go to the next step } catch (RepositoryException e1) { // other kind of exception, fail - throw new ArgeoJcrException("Cannot log in to repository", e1); + throw new JcrException("Cannot log in to repository", e1); } // log using default username / password (useful for testing purposes) @@ -85,7 +85,7 @@ public abstract class ThreadBoundJcrSessionFactory { SimpleCredentials sc = new SimpleCredentials(defaultUsername, defaultPassword.toCharArray()); newSession = repository().login(sc, workspace); } catch (RepositoryException e) { - throw new ArgeoJcrException("Cannot log in to repository", e); + throw new JcrException("Cannot log in to repository", e); } session.set(newSession); @@ -173,9 +173,9 @@ public abstract class ThreadBoundJcrSessionFactory { } /** - * Called before a method is actually called, allowing to check the session - * or re-login it (e.g. if authentication has changed). The default - * implementation returns the session. + * Called before a method is actually called, allowing to check the session or + * re-login it (e.g. if authentication has changed). The default implementation + * returns the session. */ protected Session preCall(Session session) { return session; @@ -190,7 +190,7 @@ public abstract class ThreadBoundJcrSessionFactory { if (it.hasNext()) return it.next(); } - throw new ArgeoJcrException("No repository injected"); + throw new IllegalStateException("No repository injected"); } // /** Useful for declarative registration of OSGi services (blueprint) */