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

Be less strict when getting BinaryMetadata fails for a field

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.10
    • Component/s: Binary Metadata
    • Tags:
    • Sprint:
      nxNest Sprint 8.4.7
    • Story Points:
      2

      Description

      When you upload a pictures that contains a metadata field that can't be converted to the schema:field type, the whole analysis fails.

      For example, I have a picture with a XResolution set as decimal (probably because the resolution unit is "Inches". But Nuxeo fails to save the value in an integer field:

      [org.nuxeo.ecm.core.event.impl.EventServiceImpl] Exception during binaryMetadataSyncListener sync listener execution, continuing to run other listeners
      java.lang.NumberFormatException: For input string: "0.03"
      	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      	at java.lang.Long.parseLong(Long.java:589)
      	at java.lang.Long.valueOf(Long.java:803)
      	at org.nuxeo.ecm.core.api.model.impl.primitives.LongProperty.normalize(LongProperty.java:58)
      	at org.nuxeo.ecm.core.api.model.impl.AbstractProperty.setValue(AbstractProperty.java:311)
      	at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.setPropertyValue(DocumentModelImpl.java:1439)
      	at org.nuxeo.binary.metadata.internals.BinaryMetadataServiceImpl.writeMetadata(BinaryMetadataServiceImpl.java:216)
      

      This line is involved in BinaryMetadataServiceImpl.#writeMetadata

      doc.setPropertyValue(metadataMapping.get(metadata), (Serializable) metadataValue);
      

      I really needed to get the metadata and it's ok if one fails, so I patched the call (in a custom jar) with:

      
      try {
        doc.setPropertyValue(metadataMapping.get(metadata), (Serializable) metadataValue);
      } catch (PropertyException e) {
        log.warn("Cound not set property <" + metadataMapping.get(metadata) +"> to value " + (Serializable) metadataValue);
      }
      

      But not sure of the cost of this try...catch and if there is a better way to handle that. I suppose spending time checking the type of the field vs the type of the value would be even way slower

      I set the priority to "major", because it is a big loss of feature. You successfully extract 50 info but the whole thing fails because of the 51th having a problem

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                4 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: