X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=server%2Fruntime%2Forg.argeo.server.jcr%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fjcr%2FJcrUtils.java;h=7cf287a31c8de76bfabbf91a625002bacdcff517;hb=79af724fe2acf4c5df0da2a6a72e123195d66eb8;hp=ebcb4ee9f5efd7da10c800bf077bbc320a0fbb61;hpb=4a466f59df24fa18799297486b8d084b2a1aecba;p=lgpl%2Fargeo-commons.git diff --git a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java index ebcb4ee9f..7cf287a31 100644 --- a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java +++ b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java @@ -175,9 +175,9 @@ public class JcrUtils implements ArgeoJcrConstants { buf.append('/');// 1 if (addHour) { int hour = cal.get(Calendar.HOUR_OF_DAY); + buf.append('H').append(hour);// 3 if (hour < 10) buf.append(0); - buf.append('H').append(hour);// 3 buf.append('/');// 1 } return buf.toString(); @@ -652,6 +652,21 @@ public class JcrUtils implements ArgeoJcrConstants { } } + /** + * Discards the current changes in the session attached to this node. To be + * used typically in a catch block. + * + * @see #discardQuietly(Session) + */ + public static void discardUnderlyingSessionQuietly(Node node) { + try { + discardQuietly(node.getSession()); + } catch (RepositoryException e) { + log.warn("Cannot quietly discard session of node " + node + ": " + + e.getMessage()); + } + } + /** * Discards the current changes in a session by calling * {@link Session#refresh(boolean)} with false, only logging