commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r813950 - in /commons/proper/vfs/trunk/core/src: main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
Date Fri, 11 Sep 2009 17:47:31 GMT
Author: rgoers
Date: Fri Sep 11 17:47:30 2009
New Revision: 813950

URL: http://svn.apache.org/viewvc?rev=813950&view=rev
Log:
File should be marked checked in when it is first created

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java?rev=813950&r1=813949&r2=813950&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
Fri Sep 11 17:47:30 2009
@@ -642,18 +642,24 @@
                         throw ex;
                     }
                 }
-                if (fileExists)
+                if (!fileExists)
                 {
-                    if (!isCheckedIn)
+                    createVersion(urlStr);
+                    try
+                    {
+                        DavPropertySet props = getPropertyNames(fileName);
+                        isCheckedIn = !props.contains(VersionControlledResource.CHECKED_OUT);
+                    }
+                    catch (FileNotFoundException fnfe)
                     {
-                        CheckinMethod checkin = new CheckinMethod(urlStr);
-                        setupMethod(checkin);
-                        execute(checkin);
+                        // Ignore the error
                     }
                 }
-                else
+                if (!isCheckedIn)
                 {
-                    createVersion(urlStr);
+                  CheckinMethod checkin = new CheckinMethod(urlStr);
+                  setupMethod(checkin);
+                  execute(checkin);
                 }
             }
             else

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java?rev=813950&r1=813949&r2=813950&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
Fri Sep 11 17:47:30 2009
@@ -63,7 +63,7 @@
         {
             assertEquals(name, map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         }
-        assertTrue(map.containsKey(VersionControlledResource.CHECKED_OUT.toString()));
+        assertTrue(map.containsKey(VersionControlledResource.CHECKED_IN.toString()));
 
         // Create the source file
         final String content = "Here is some sample content for the file.  Blah Blah Blah.";
@@ -120,7 +120,7 @@
             assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
             assertEquals("Modified by user " + name, map.get(DeltaVConstants.COMMENT.toString()));
         }
-        assertTrue(map.containsKey(VersionControlledResource.CHECKED_OUT.toString()));
+        assertTrue(map.containsKey(VersionControlledResource.CHECKED_IN.toString()));
 
         // Create the source file
         final String content = "Here is some sample content for the file.  Blah Blah Blah.";
@@ -143,11 +143,11 @@
         {
             assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
             assertEquals("Modified by user " + name, map.get(DeltaVConstants.COMMENT.toString()));
-        }       
+        }
         assertTrue(map.containsKey(VersionControlledResource.CHECKED_IN.toString()));
         builder.setVersioning(opts, false);
         builder.setCreatorName(opts, null);
-    }  
+    }
         /**
      * Sets up a scratch folder for the test to use.
      */



Mime
View raw message