]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java
Fix typo in date path generation
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.jcr / src / main / java / org / argeo / jcr / JcrUtils.java
index ebcb4ee9f5efd7da10c800bf077bbc320a0fbb61..7cf287a31c8de76bfabbf91a625002bacdcff517 100644 (file)
@@ -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 <code>false</code>, only logging