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
Fix For: 2.6.6 Final
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: