Apply patch for VFS-263

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/vfs/branches/VFS281@835215 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java b/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
index 2de8de4..81e5e11 100644
--- a/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
+++ b/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
@@ -51,6 +51,7 @@
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.MultiStatus;
 import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.webdav.xml.Namespace;
 import org.apache.jackrabbit.webdav.version.DeltaVConstants;
 import org.apache.jackrabbit.webdav.version.VersionControlledResource;
 import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
@@ -302,6 +303,49 @@
         }
     }
 
+    /**
+     * Sets an attribute of this file.  Is only called if {@link #doGetType}
+     * does not return {@link FileType#IMAGINARY}.
+     * <p/>
+     * This implementation throws an exception.
+     */
+    protected void doSetAttribute(final String attrName, final Object value)
+        throws Exception
+    {
+        try
+        {
+            URLFileName fileName = (URLFileName) getName();
+            String urlStr = urlString(fileName);
+            DavPropertySet properties = new DavPropertySet();
+            DavPropertyNameSet propertyNameSet = new DavPropertyNameSet();
+            DavProperty property = new DefaultDavProperty(attrName, value, Namespace.EMPTY_NAMESPACE);
+            if (value != null)
+            {
+                properties.add(property);
+            }
+            else
+            {
+                propertyNameSet.add(property.getName()); // remove property
+            }
+
+            PropPatchMethod method = new PropPatchMethod(urlStr, properties, propertyNameSet);
+            setupMethod(method);
+            execute(method);
+            if (!method.succeeded())
+            {
+                throw new FileSystemException("Property '" + attrName + "' could not be set.");
+            }
+        }
+        catch (FileSystemException fse)
+        {
+            throw fse;
+        }
+        catch(Exception e)
+        {
+            throw new FileSystemException("vfs.provider.webdav/propfind.error", getName(), e);
+        }
+    }    
+
     protected OutputStream doGetOutputStream(boolean bAppend) throws Exception
     {
         return new WebdavOutputStream(this);
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index bec2e34..93376e9 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -23,9 +23,12 @@
 
   <body>
     <release version="2.0" date="in SVN" description="">
+      <action dev="rgoers" type="update" issue="VFS-263" due-to="Ingo Maas">
+        WebdavFileObject does not implement doSetAttribute()
+      </action>        
       <action dev="rgoers" type="fix" issue="VFS-259" due-to="Marek Zawirski">
         Http and Webdav FIleContentInfoFactory: undress to AbstractFileObject before casting
-      </action>      
+      </action>
       <action dev="rgoers" type="fix" issue="VFS-261" due-to="Simon Olofsson">
         WebDAV upload corrupts binary files
       </action>