jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1235746 - in /jackrabbit/branches/2.4: ./ jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/ jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/jcr/ jackrabbit-webdav/src/main/java/org/apache/jackrabbi...
Date Wed, 25 Jan 2012 13:49:14 GMT
Author: jukka
Date: Wed Jan 25 13:49:14 2012
New Revision: 1235746

URL: http://svn.apache.org/viewvc?rev=1235746&view=rev
Log:
2.4: Merged revision 1235375 (JCR-3214)

Added:
    jackrabbit/branches/2.4/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/jcr/LockTimeOutFormatTest.java
      - copied unchanged from r1235375, jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/jcr/LockTimeOutFormatTest.java
Modified:
    jackrabbit/branches/2.4/   (props changed)
    jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java
    jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java

Propchange: jackrabbit/branches/2.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 25 13:49:14 2012
@@ -1,3 +1,3 @@
 /jackrabbit/branches/JCR-2272:1173165-1176545
 /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038
-/jackrabbit/trunk:1221447,1221579,1221593,1221789,1221818,1225179,1225191,1225196,1225207,1225525,1225528,1226452,1226472,1226515,1226750,1226863,1227171,1227240,1227590,1227593,1227615,1228058,1228149,1228155,1228160,1230507,1230681,1230688,1231204,1232035,1232100,1232404,1232831,1232920,1232922,1233069,1233344,1233446,1233468,1233471,1234807,1235192,1235423
+/jackrabbit/trunk:1221447,1221579,1221593,1221789,1221818,1225179,1225191,1225196,1225207,1225525,1225528,1226452,1226472,1226515,1226750,1226863,1227171,1227240,1227590,1227593,1227615,1228058,1228149,1228155,1228160,1230507,1230681,1230688,1231204,1232035,1232100,1232404,1232831,1232920,1232922,1233069,1233344,1233446,1233468,1233471,1234807,1235192,1235375,1235423

Modified: jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java?rev=1235746&r1=1235745&r2=1235746&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java
Wed Jan 25 13:49:14 2012
@@ -127,15 +127,27 @@ public class JcrActiveLock extends Abstr
      * Calculates the milliseconds of the timeout from
      * {@link javax.jcr.lock.Lock#getSecondsRemaining()}. If the timeout of
      * jcr lock is undefined or infinite {@link #INFINITE_TIMEOUT} is
-     * returned. A missing timeout causes problems with Microsoft clients.
+     * returned.
      *
-     * @return Always returns {@link #INFINITE_TIMEOUT}
      * @see ActiveLock#getTimeout()
      */
     public long getTimeout() {
         try {
             long to = lock.getSecondsRemaining();
-            return (to == Long.MAX_VALUE) ? INFINITE_TIMEOUT : to*1000;
+            long reportAs;
+
+            if (to == Long.MAX_VALUE) {
+                reportAs = INFINITE_TIMEOUT;
+            }
+            else if (to / 1000 <= Long.MAX_VALUE / 1000) {
+                // expressible as long?
+                reportAs = to * 1000;
+            }
+            else {
+                reportAs = INFINITE_TIMEOUT;
+            }
+
+            return reportAs;
         } catch (RepositoryException e) {
             return INFINITE_TIMEOUT;
         }

Modified: jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java?rev=1235746&r1=1235745&r2=1235746&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/xml/DomUtil.java
Wed Jan 25 13:49:14 2012
@@ -685,17 +685,14 @@ public class DomUtil {
     /**
      * Converts the given timeout (long value defining the number of milli-
      * second until timeout is reached) to its Xml representation as defined
-     * by RTF 2518.<br>
-     * Note, that {@link DavConstants#INFINITE_TIMEOUT} is not represented by the String
-     * {@link DavConstants#TIMEOUT_INFINITE 'Infinite'} defined by RFC 2518, due to a known
-     * issue with Microsoft Office that opens the document "read only" and
-     * never unlocks the resource if the timeout is missing or 'Infinite'.
+     * by RFC 4918.<br>
      *
      * @param timeout number of milli-seconds until timeout is reached.
      * @return 'timeout' Xml element
      */
     public static Element timeoutToXml(long timeout, Document factory) {
-        String expString = "Second-"+ timeout/1000;
+        boolean infinite = timeout / 1000 > Integer.MAX_VALUE || timeout == DavConstants.INFINITE_TIMEOUT;
+        String expString = infinite ? DavConstants.TIMEOUT_INFINITE : "Second-" + timeout
/ 1000;
         return createElement(factory, DavConstants.XML_TIMEOUT, DavConstants.NAMESPACE, expString);
     }
 



Mime
View raw message