Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-15836

The PictureChangedListener silently modifies a version

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Not A Bug
    • Affects Version/s: 6.0
    • Fix Version/s: None
    • Component/s: Core, Image Management

      Description

      My use case which highlithed this bug:

      • Use the pictureViewsGenerationDone event to store custom views in `picture:views` (you can see the code of nuxeo-fujixerox plug-in here)
      • When a version of the document is created: (1) The default nuxeo views are recalculated (yes, on a version) and (2) hence, my custom renditions are lost on the version

      The bug: The views should not be recalculated on a version.

      To reproduce:

      • install this nuxeo-fujixerox plug-in
      • Add a picture. WARNING; because the plug-in has a "validate picture metadata" event, make sure your picture has a colorspace and a resolution (which is the case for almost all .jpg)
        • It's asynchronous. Possibly, wait 3-4 seconds to make sure all is good
      • In the "export options", check you have the misc. views in the picture:views field ("jpeg200x200", ...)
      • Go to the "Edit" tab, increment the version number, change nothing, no fields, nothing, just the version number, and save
      • Now go to "History" tab, "Archived verison", ann open the version
      • In the "export options", you'll see the custom views have been removed.

      After tracing and settings breakpoints with Thierry D., the point is: Despite it is a version the PictureChangedListener re-calculate the views because of this line:

      . . .
       if (DOCUMENT_CREATED.equals(event.getName()) || fileProp.isDirty()) {
      . . .
      

      Nuxeo is creating a version, so the DOCUMENT_CREATED.equals(event.getName() test evaluates to true.

      The test should be something like:

      if (!doc.isImmutable() && (DOCUMENT_CREATED.equals(event.getName()) || fileProp.isDirty())
      

      (check (!doc.isImmutable())

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: