NumberFormatException in writing Binary Metadata

  1. Nuxeo Platform
  2. NXP-19881

Be less strict when getting BinaryMetadata fails for a field

this Issue is still not fixed in Version 10.10 .I am getting NumberFormatException if EXIF:XResoultion is in Decimal having value 71.983.

I am attaching the image file for which this error is occuring

LongProperty.java

public Serializable normalize(Object value) throws PropertyConversionException {

    if (isNormalized(value)) {
        return (Serializable) value;
    }
    if (value.getClass() == String.class) {
        String string = (String) value;
        if (string.length() == 0) {
            return null;
        }
       ** return Long.valueOf(value.toString());** //Getting Error here Long.valueOf("71.983")
    }
    if (value instanceof Number) {
        return ((Number) value).longValue();
    }
    throw new PropertyConversionException(value.getClass(), Long.class);
}

this error will not redirect to BinaryMetadataServiceImpl.java

doc.setPropertyValue(property, (Serializable) metadataValue);

            } catch (PropertyException e) {
                log.warn(String.format(
                        "Failed to set property '%s' to value %s from metadata '%s' in '%s' in document '%s' ('%s')",
                        property, metadataValue, metadata, mappingDescriptor.getBlobXPath(), doc.getId(),
                        doc.getPath()));
            }

Getting Below Error in server Logs:-

2020-04-17T17:51:19,543 ERROR [http-nio-0.0.0.0-8081-exec-14] [org.nuxeo.ecm.core.event.impl.EventServiceImpl] Exception during binaryMetadataSyncListener sync listener execution, other listeners will be ignored java.lang.NumberFormatException: For input string: “71.983”

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_242]
at java.lang.Long.parseLong(Long.java:589) ~[?:1.8.0_242]
at java.lang.Long.valueOf(Long.java:803) ~[?:1.8.0_242]
at org.nuxeo.ecm.core.api.model.impl.primitives.LongProperty.normalize(LongProperty.java:58) ~[nuxeo-core-api-10.10.jar:?]
at org.nuxeo.ecm.core.api.model.impl.AbstractProperty.setValue(AbstractProperty.java:387) ~[nuxeo-core-api-10.10.jar:?]
at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.setPropertyValue(DocumentModelImpl.java:1280) ~[nuxeo-core-api-10.10.jar:?]
at org.nuxeo.binary.metadata.internals.BinaryMetadataServiceImpl.writeMetadata(BinaryMetadataServiceImpl.java:226) ~[nuxeo-binary-metadata-10.10.jar:?]
at org.nuxeo.binary.metadata.internals.BinaryMetadataServiceImpl.writeMetadata(BinaryMetadataServiceImpl.java:169) ~[nuxeo-binary-metadata-10.10.jar:?]
at org.nuxeo.binary.metadata.internals.listeners.BinaryMetadataSyncListener.handleEvent(BinaryMetadataSyncListener.java:56) ~[nuxeo-binary-metadata-10.10.jar:?]
at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:242) [nuxeo-core-event-10.10.jar:?]
at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:265) [nuxeo-core-10.10.jar:?]
at org.nuxeo.ecm.core.api.AbstractSession.createDocument(AbstractSession.java:686) [nuxeo-core-10.10.jar:?]
FILES:   screen-3.jpg
0 votes

0 answers

769 views

ANSWER