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 ju...@apache.org on 2001/08/30 16:41:02 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/macro MacroImpl.java

juergen     01/08/30 07:41:02

  Modified:    src/share/org/apache/slide/macro MacroImpl.java
  Log:
  Do not do a second delete. In case of multi user, the second delete may be successfull and no exception is thrown. Remy, do you want to have a review on this?
  
  Revision  Changes    Path
  1.19      +15 -16    jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java
  
  Index: MacroImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- MacroImpl.java	2001/07/03 04:54:14	1.18
  +++ MacroImpl.java	2001/08/30 14:41:02	1.19
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v 1.18 2001/07/03 04:54:14 remm Exp $
  - * $Revision: 1.18 $
  - * $Date: 2001/07/03 04:54:14 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v 1.19 2001/08/30 14:41:02 juergen Exp $
  + * $Revision: 1.19 $
  + * $Date: 2001/08/30 14:41:02 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * Macro helper class.
    *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.18 $
  + * @version $Revision: 1.19 $
    */
   public final class MacroImpl implements Macro {
       
  @@ -194,11 +194,10 @@
                   delete(token, destinationUri);
               } catch(ObjectNotFoundException e) {
                   // Silent catch, the target doesn't exist
  -            } catch(SlideException e) {
  -                // We try to delete the target anyway.
  -                // It will probably fail again, but we will get a properly
  -                // packaged exception
  -                delete(token, destinationUri);
  +            } catch(SlideException s) {
  +                CopyMacroException e = new CopyMacroException("Copy failed");
  +                e.addException(s);
  +                throw e;
               }
           }
           
  @@ -313,12 +312,12 @@
               Vector childrenListVector = new Vector();
               
               // Copying structure
  -            ObjectNode object = 
  +            ObjectNode object =
                   structureHelper.retrieve(token, sourceUri, false);
               
               // Creating the copy
               try {
  -                structureHelper.create(token, object.copyObject(), 
  +                structureHelper.create(token, object.copyObject(),
                                          destinationUri);
               } catch (ObjectNotFoundException s){
                   throw new ConflictException(s.getObjectUri());
  @@ -401,7 +400,7 @@
               }
               
           } catch(SlideException ex) {
  -            // ex.printStackTrace(); the exception is packed and 
  +            // ex.printStackTrace(); the exception is packed and
               // (hopefully) reported in the response
               e.addException(ex);
           }
  @@ -425,7 +424,7 @@
           
           try {
               
  -            ObjectNode currentObject = 
  +            ObjectNode currentObject =
                   structureHelper.retrieve(token, targetUri, false);
               
               // Removing children objects
  @@ -453,7 +452,7 @@
                   Enumeration permissions = securityHelper.enumeratePermissions
                       (token, currentObject);
                   while (permissions.hasMoreElements()) {
  -                    NodePermission permission = 
  +                    NodePermission permission =
                           (NodePermission) permissions.nextElement();
                       securityHelper.revokePermission(token, permission);
                   }
  @@ -474,8 +473,8 @@
               
           } catch (ObjectHasChildrenException ex) {
               // ignore, the object has children because something else failed
  -            // (one of the children is locked, for example), and the 
  -            // corresponding exception has already been added the the 
  +            // (one of the children is locked, for example), and the
  +            // corresponding exception has already been added the the
               // MacroException
           } catch (SlideException ex) {
               e.addException(ex);
  
  
  

Re: cvs commit: jakarta-slide/src/share/org/apache/slide/macro MacroImpl.java

Posted by Remy Maucherat <re...@apache.org>.
> juergen     01/08/30 07:41:02
>
>   Modified:    src/share/org/apache/slide/macro MacroImpl.java
>   Log:
>   Do not do a second delete. In case of multi user, the second delete may
be successfull and no exception is thrown. Remy, do you want to have a
review on this?

It seems totally ok with me, as I can't remember the purpose of the second
delete.
Why does it succeed the second time in some cases ? (That sounds like a bug
to me)

Remy