You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by lu...@apache.org on 2004/11/08 09:35:46 UTC

cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method CopyMethod.java

luetzkendorf    2004/11/08 00:35:46

  Modified:    src/webdav/server/org/apache/slide/webdav/method Tag:
                        SLIDE_2_1_RELEASE_BRANCH CopyMethod.java
  Log:
  fixed bug for copy with Overwrite: T. (it does not depent from the resource type
  how copy has to be executed. If Overwrite: T the restination has to be deleted first)
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.67.2.2  +6 -33     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java
  
  Index: CopyMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
  retrieving revision 1.67.2.1
  retrieving revision 1.67.2.2
  diff -u -r1.67.2.1 -r1.67.2.2
  --- CopyMethod.java	18 Oct 2004 08:42:58 -0000	1.67.2.1
  +++ CopyMethod.java	8 Nov 2004 08:35:46 -0000	1.67.2.2
  @@ -172,7 +172,6 @@
           
           try {
               // compare resource types of source and destination
  -            boolean sameResourceType = isSameResourcetype();
               int depth = requestHeaders.getDepth(INFINITY);
               if (depth != 0 && depth != INFINITY) {
                   int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  @@ -182,13 +181,9 @@
               
               boolean recursive = (depth == INFINITY);
               
  -            if (overwrite && sameResourceType) {
  -                macroParameters = new MacroParameters(recursive, true, false);
  -            }
  -            else if (overwrite && !sameResourceType) {
  +            if (overwrite) {
                   macroParameters = new MacroParameters(recursive, true, true);
  -            }
  -            else {
  +            } else {
                   macroParameters = new MacroParameters(recursive, false, false);
               }
               
  @@ -258,27 +253,6 @@
           }
       }
       
  -    private boolean isSameResourcetype() throws ServiceAccessException {
  -        boolean sameResourceType = false;
  -        try {
  -            NodeRevisionDescriptor sourceNrd =
  -                content.retrieve( slideToken, content.retrieve(slideToken, sourceUri) );
  -            NodeRevisionDescriptor destinationNrd =
  -                content.retrieve( slideToken, content.retrieve(slideToken, destinationUri) );
  -            sameResourceType =
  -                sourceNrd.getResourceType().equals(destinationNrd.getResourceType());
  -        }
  -        catch (ServiceAccessException e) {
  -            throw e;
  -        }
  -        catch (SlideException e) {
  -            // ignore silently
  -        }
  -        return sameResourceType;
  -    }
  -    
  -    
  -    
       /**
        * Get return status based on exception type.
        */
  @@ -435,6 +409,7 @@
               
               try {
                   sourceUri = versioningHelper.getLabeledResourceUri(sourceUri, labelHeader);
  +                copyRoute = new CopyRoute(sourceUri, destinationUri);
               }
               catch (LabeledRevisionNotFoundException e) {
                   ViolatedPrecondition violatedPrecondition =
  @@ -442,8 +417,6 @@
                                                WebdavStatus.SC_CONFLICT);
                   throw new PreconditionViolationException(violatedPrecondition, sourceUri);
               }
  -            
  -            copyRoute = new CopyRoute(sourceUri, destinationUri);
           }
           
           return copyRoute;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org