luetzkendorf    2004/11/08 01:04:33

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        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
  1.70      +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.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- CopyMethod.java   26 Oct 2004 20:06:01 -0000      1.69
  +++ CopyMethod.java   8 Nov 2004 09:04:33 -0000       1.70
  @@ -184,7 +184,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;
  @@ -194,13 +193,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);
               }
               
  @@ -270,27 +265,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.
        */
  @@ -447,6 +421,7 @@
               
               try {
                   sourceUri = 
versioningHelper.getLabeledResourceUri(sourceUri, labelHeader);
  +                copyRoute = new CopyRoute(sourceUri, destinationUri);
               }
               catch (LabeledRevisionNotFoundException e) {
                   ViolatedPrecondition violatedPrecondition =
  @@ -454,8 +429,6 @@
                                                WebdavStatus.SC_CONFLICT);
                   throw new 
PreconditionViolationException(violatedPrecondition, sourceUri);
               }
  -            
  -            copyRoute = new CopyRoute(sourceUri, destinationUri);
           }
           
           return copyRoute;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to