You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rg...@apache.org on 2009/09/11 19:47:31 UTC

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

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.
      */