remm 01/07/02 21:54:19
Modified: src/share/org/apache/slide/macro MacroImpl.java
Log:
- Fix a serious bug when deleting or copying links, where the link target would
get deleted or copied (which obviously is incorrect).
Bug reported by Matthew Stone <matt.stone at jcafeinc.com>
Revision Changes Path
1.18 +24 -22 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- MacroImpl.java 2001/06/28 01:21:23 1.17
+++ MacroImpl.java 2001/07/03 04:54:14 1.18
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v 1.17
2001/06/28 01:21:23 remm Exp $
- * $Revision: 1.17 $
- * $Date: 2001/06/28 01:21:23 $
+ * $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 $
*
* ====================================================================
*
@@ -77,7 +77,7 @@
* Macro helper class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @version $Revision: 1.17 $
+ * @version $Revision: 1.18 $
*/
public final class MacroImpl implements Macro {
@@ -313,13 +313,14 @@
Vector childrenListVector = new Vector();
// Copying structure
- ObjectNode object = structureHelper.retrieve(token, sourceUri);
+ ObjectNode object =
+ structureHelper.retrieve(token, sourceUri, false);
// Creating the copy
try {
- structureHelper.create(token, object.copyObject(), destinationUri);
- }
- catch (ObjectNotFoundException s){
+ structureHelper.create(token, object.copyObject(),
+ destinationUri);
+ } catch (ObjectNotFoundException s){
throw new ConflictException(s.getObjectUri());
}
@@ -350,7 +351,7 @@
// Now copying revision descriptors and content
NodeRevisionDescriptors revisionDescriptors =
- contentHelper.retrieve(token, sourceUri);
+ contentHelper.retrieve(token, object.getUri());
if (revisionDescriptors.hasRevisions()) {
@@ -390,8 +391,6 @@
// We copy each of this object's children
- object = structureHelper.retrieve(token, sourceUri);
-
Enumeration childrenList = object.enumerateChildren();
while(childrenList.hasMoreElements()) {
String childUri = (String) childrenList.nextElement();
@@ -402,7 +401,8 @@
}
} catch(SlideException ex) {
- // ex.printStackTrace(); the exception is packed and (hopefully)
reported in the response
+ // ex.printStackTrace(); the exception is packed and
+ // (hopefully) reported in the response
e.addException(ex);
}
@@ -425,8 +425,8 @@
try {
- ObjectNode currentObject = structureHelper.retrieve(token,
- targetUri);
+ ObjectNode currentObject =
+ structureHelper.retrieve(token, targetUri, false);
// Removing children objects
if (currentObject.hasChildren()) {
@@ -436,29 +436,32 @@
}
}
-
// Removing all revisions
NodeRevisionDescriptors revisionDescriptors =
- contentHelper.retrieve(token, targetUri);
+ contentHelper.retrieve(token, currentObject.getUri());
// if the object is not revisioned remove it completely
// from it's associated stores
if (!revisionDescriptors.isVersioned()) {
// remove the associated locks
- Enumeration locks = lockHelper.enumerateLocks(token, targetUri);
+ Enumeration locks = lockHelper.enumerateLocks
+ (token, currentObject.getUri());
while (locks.hasMoreElements()) {
lockHelper.unlock(token, (NodeLock) locks.nextElement());
}
// remove the associated security
- Enumeration permissions =
securityHelper.enumeratePermissions(token, targetUri);
+ Enumeration permissions = securityHelper.enumeratePermissions
+ (token, currentObject);
while (permissions.hasMoreElements()) {
- NodePermission permission = (NodePermission)
permissions.nextElement();
+ NodePermission permission =
+ (NodePermission) permissions.nextElement();
securityHelper.revokePermission(token, permission);
}
// remove the NodeRevisionDescriptor and associated content
if (revisionDescriptors.hasRevisions()) {
- contentHelper.remove(token, targetUri,
- revisionDescriptors.getInitialRevision());
+ contentHelper.remove
+ (token, currentObject.getUri(),
+ revisionDescriptors.getInitialRevision());
}
// remove the NodeRevisionDescriptors object
@@ -468,7 +471,6 @@
// Removing object.
structureHelper.remove(token, currentObject);
-
} catch (ObjectHasChildrenException ex) {
// ignore, the object has children because something else failed