Uploaded image for project: 'JBoss Portal'
  1. JBoss Portal
  2. JBPORTAL-2002

VersionException thrown when you try to upload an archive (ZIP) that contains files that already exists in the repository


    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.6.4 Final
    • Fix Version/s: 2.6.6 Final
    • Component/s: Portal CMS
    • Labels:
    • Environment:

      JBoss AS 4.2.2, JBoss Portal 2.6.4


      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);

      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.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).

        Gliffy Diagrams




              • Assignee:
                soshah Sohil Shah
                xalperte Javier Alperte
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: