remm 01/02/01 15:19:16
Modified: src/share/org/apache/slide/macro MacroImpl.java
Log:
- Code cleanup.
- Will use the NodeRevisionDescriptors.hasRevisions() to make sure that a
node has revisions. Before, the copy was failing if the object didn't have
any revisions.
Thanks to Michael Smith <[EMAIL PROTECTED]> for the bug report
and the fix.
Revision Changes Path
1.7 +30 -38 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- MacroImpl.java 2000/11/25 01:34:53 1.6
+++ MacroImpl.java 2001/02/01 23:19:12 1.7
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v 1.6
2000/11/25 01:34:53 remm Exp $
- * $Revision: 1.6 $
- * $Date: 2000/11/25 01:34:53 $
+ * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/macro/MacroImpl.java,v 1.7
2001/02/01 23:19:12 remm Exp $
+ * $Revision: 1.7 $
+ * $Date: 2001/02/01 23:19:12 $
*
* ====================================================================
*
@@ -76,7 +76,7 @@
* Macro helper class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public final class MacroImpl implements Macro {
@@ -319,15 +319,6 @@
securityHelper.grantPermission(token, newPermission);
}
- /*
- public void grantPermission(SlideToken token,
- ObjectNode object,
- SubjectNode subject, ActionNode action,
- boolean inheritable)
- NodePermission(String objectUri, String subjectUri,
- String actionUri, boolean inheritable)
- */
-
} catch (AccessDeniedException ex) {
// Means that we don't have modifyPermissions rights
// (root access) on the target.
@@ -340,29 +331,33 @@
NodeRevisionDescriptors revisionDescriptors =
contentHelper.retrieve(token, sourceUri);
- // Iterators
- NodeRevisionNumber currentRevisionNumber =
- revisionDescriptors.getInitialRevision();
- NodeRevisionDescriptor currentRevisionDescriptor = null;
- NodeRevisionContent currentRevisionContent = null;
-
- Stack revisionNumbers = new Stack();
- revisionNumbers.push(currentRevisionNumber);
-
- // Creating the initial revision
- currentRevisionDescriptor = contentHelper
- .retrieve(token, revisionDescriptors,
- currentRevisionNumber);
- if (currentRevisionDescriptor.getContentLength() > 0) {
- currentRevisionContent = contentHelper
- .retrieve(token, revisionDescriptors,
- currentRevisionDescriptor);
- } else {
- currentRevisionContent = null;
+ if (revisionDescriptors.hasRevisions()) {
+
+ // Iterators
+ NodeRevisionNumber currentRevisionNumber =
+ revisionDescriptors.getInitialRevision();
+ NodeRevisionDescriptor currentRevisionDescriptor = null;
+ NodeRevisionContent currentRevisionContent = null;
+
+ Stack revisionNumbers = new Stack();
+ revisionNumbers.push(currentRevisionNumber);
+
+ // Creating the initial revision
+ currentRevisionDescriptor = contentHelper
+ .retrieve(token, revisionDescriptors,
+ currentRevisionNumber);
+ if (currentRevisionDescriptor.getContentLength() > 0) {
+ currentRevisionContent = contentHelper
+ .retrieve(token, revisionDescriptors,
+ currentRevisionDescriptor);
+ } else {
+ currentRevisionContent = null;
+ }
+ contentHelper.create(token, destinationUri,
+ currentRevisionDescriptor,
+ currentRevisionContent);
+
}
- contentHelper.create(token, destinationUri,
- currentRevisionDescriptor,
- currentRevisionContent);
// TODO : Parse stack
// Algorithm :
@@ -411,9 +406,6 @@
ObjectNode currentObject = structureHelper.retrieve(token,
targetUri);
-
- //System.out.println("Uri : " + targetUri + " Object : "
- // + currentObject);
// Removing children objects
if (currentObject.hasChildren()) {