[portal-commits] JBoss Portal SVN: r11976 - branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/impl/jcr/command.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Thu Sep 25 02:59:23 EDT 2008


Author: sohil.shah at jboss.com
Date: 2008-09-25 02:59:23 -0400 (Thu, 25 Sep 2008)
New Revision: 11976

Modified:
   branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java
Log:
JBPORTAL-2172 - Path inconsistency for import/export archive

Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java	2008-09-25 03:12:35 UTC (rev 11975)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java	2008-09-25 06:59:23 UTC (rev 11976)
@@ -26,6 +26,7 @@
 import org.jboss.portal.cms.impl.jcr.JCRCommandContext;
 import org.jboss.portal.cms.model.Content;
 import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.util.NodeUtil;
 
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
@@ -99,17 +100,23 @@
          while (ni.hasNext())
          {
             Node node = ni.nextNode();
-            NodeType nt = node.getPrimaryNodeType();
+            NodeType nt = node.getPrimaryNodeType();            
             if (nt.getName().equals("portalcms:folder"))
             {
                this.zipFiles(node.getPath(), zos);
             }
             else if (nt.getName().equals("portalcms:file"))
             {
+               String diff = node.getPath();
+               if(!this.msRootPath.equals("/"))
+               {
+                  diff = node.getPath().substring(NodeUtil.getParentPath(this.msRootPath).length());
+               }
+               
                JCRCommand fileList = (JCRCommand)this.mContext.getCommandFactory().createFileGetCommand(node.getPath(), new Locale(this.msLanguage));
                File childFile = (File)this.mContext.execute(fileList);
 
-               ZipEntry entry = new ZipEntry(this.rootFolderName + node.getPath());
+               ZipEntry entry = new ZipEntry(diff);
                zos.putNextEntry(entry);
                Content content = childFile.getContent();
 




More information about the portal-commits mailing list