jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r523640 - /jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
Date Thu, 29 Mar 2007 09:10:09 GMT
Author: angela
Date: Thu Mar 29 02:10:08 2007
New Revision: 523640

URL: http://svn.apache.org/viewvc?view=rev&rev=523640
Log:
JCR-824 Problems with File Copy using WebDAV

Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java?view=diff&rev=523640&r1=523639&r2=523640
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
Thu Mar 29 02:10:08 2007
@@ -578,6 +578,8 @@
         if (isFilteredResource(destination)) {
             throw new DavException(DavServletResponse.SC_FORBIDDEN);
         }
+        // make sure, that src and destination belong to the same workspace
+        checkSameWorkspace(destination.getLocator());
         try {
             String destItemPath = destination.getLocator().getRepositoryPath();
             getJcrSession().getWorkspace().move(locator.getRepositoryPath(), destItemPath);
@@ -605,6 +607,8 @@
             // otherwise it doesn't make a difference
             throw new DavException(DavServletResponse.SC_FORBIDDEN, "Unable to perform shallow
copy.");
         }
+        // make sure, that src and destination belong to the same workspace
+        checkSameWorkspace(destination.getLocator());
         try {
             String destItemPath = destination.getLocator().getRepositoryPath();
             getJcrSession().getWorkspace().copy(locator.getRepositoryPath(), destItemPath);
@@ -873,6 +877,13 @@
 
     private boolean isFilteredItem(Item item) {
         return filter != null && filter.isFilteredItem(item);
+    }
+
+    private void checkSameWorkspace(DavResourceLocator otherLoc) throws DavException {
+        String wspname = getJcrSession().getWorkspace().getName();
+        if (!wspname.equals(otherLoc.getWorkspaceName())) {
+            throw new DavException(DavServletResponse.SC_FORBIDDEN, "Workspace mismatch:
expected '" + wspname + "'; found: '" + otherLoc.getWorkspaceName() + "'");
+        }
     }
 
     //--------------------------------------------------------< inner class >---



Mime
View raw message