[jboss-jira] [JBoss JIRA] Updated: (JBPORTAL-2002) VersionException thrown when you try to upload an archive (ZIP) that contains files that already exists in the repository
Javier Alperte (JIRA)
jira-events at lists.jboss.org
Fri May 9 22:14:22 EDT 2008
[ http://jira.jboss.com/jira/browse/JBPORTAL-2002?page=all ]
Javier Alperte updated JBPORTAL-2002:
-------------------------------------
Attachment: ContentCreateCommand.java
There was an error in the previous version I upload.
The problema was that I didn't catch the PathNotFoundException when I try to locate the node in the context, thing that happens when this is the first time we upload a file.
> VersionException thrown when you try to upload an archive (ZIP) that contains files that already exists in the repository
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: JBPORTAL-2002
> URL: http://jira.jboss.com/jira/browse/JBPORTAL-2002
> Project: JBoss Portal
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Portal CMS
> Affects Versions: 2.6.4 Final
> Environment: JBoss AS 4.2.2, JBoss Portal 2.6.4
> Reporter: Javier Alperte
> Assigned To: Sohil Shah
> Attachments: ContentCreateCommand.java, ContentCreateCommand.java
>
>
> NOTE: I attach a custom implementation for the "org.jboss.portal.cms.impl.jcr.command.ContentCreateCommand" that solves the problem for me.
> The problem:
> If you exports a directory content (for instance: "/default" folder), you make some changes to some files (for instance "index,html"), you zip all the files and try to upload the entire zip to the same directory (make changes over the existent files), the system throwns a VersionException because the system is trying to modify a property over an existent node without doing checkout.
> What are happening?
> The CMSAminPortlet is executing the following commands:
> Command storearchiveCMD = CMSService.getCommandFactory().createStoreArchiveCommand(sPath, is, sLanguage);
> List contentstoVersion = (List)CMSService.execute(storearchiveCMD);
> Command createVersions = CMSService.getCommandFactory().createContentCreateNewVersionCommand(contentstoVersion, true);
> CMSService.execute(createVersions);
> The command that - i think - is not doing his work fine is the first one (org.jboss.portal.cms.impl.jcr.command.ContentCreateCommand), the implementation is assuming that the files (file+language) doesn't exists in the repository.
> Exactly, the ContentCreateCommand is looking for the Node that points to the File in the repository (basePath), and adding a new Node for the given language. Instead of that, the code should check if the Node for that language already exists.
> If the Node (for the given language) already exists, then we only need to change the "jcr:data" and "jcr:lastModified", invoking first the "checout()" method for the node, as i show here:
>
> contentNode.checkout();
> contentNode.setProperty("jcr:data", new BinaryValue(mFile.getContent().getBytes()));
> contentNode.setProperty("jcr:lastModified", new DateValue(Calendar.getInstance()));
> Then, the node is ready to be versioned by the next Command executed in the CMSAdminPortlet (createContentCreateNewVersionCommand).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list