Directory ApacheDS
  1. Directory ApacheDS
  2. DIRSERVER-1692

Unable to add a JPEG image to an entry due to an 'Invalid Attribute Syntax' error

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M4, 2.0.0-M5
    • Fix Version/s: 2.0.0-M6
    • Component/s: ldap
    • Labels:
      None

      Description

      When I try to add an image, the server rejects it.

      Here's the complete error trace from Studio:
      Error while executing LDIF

      • [LDAP: error code 21 - INVALID_ATTRIBUTE_SYNTAX: failed for MessageType : MODIFY_REQUES
        javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - INVALID_ATTRIBUTE_SYNTAX: failed for MessageType : MODIFY_REQUEST
        Message ID : 19
        Modify Request
        Object : 'cn=test,dc=openengsb,dc=org'
        Modification[0]
        Operation : add
        Modification
        jpegPhoto: '0xFF 0xD8 0xFF 0xE1 0x00 0x18 0x45 0x78 0x69 0x66 0x00 0x00 0x49 0x49 0x2A 0x00 ...'
        org.apache.directory.shared.ldap.model.message.ModifyRequestImpl@6e3926ee: ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value ERR_04473_NOT_VALID_VALUE Not a valid value '[B@1ff6c2a9' for the AttributeType 'ATTRIBUTE_TYPE ( 0.9.2342.19200300.100.1.60
        NAME 'jpegPhoto'
        DESC RFC2798: a JPEG image
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.28
        USAGE userApplications
        )
        ']; remaining name 'cn=test,dc=openengsb,dc=org'
        at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3080)
        at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3013)
        at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820)
        at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1458)
        at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(ComponentDirContext.java:255)
        at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:172)
        at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper$2.run(JNDIConnectionWrapper.java:454)
        at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.runAndMonitor(JNDIConnectionWrapper.java:1272)
        at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.checkConnectionAndRunAndMonitor(JNDIConnectionWrapper.java:1203)
        at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.modifyEntry(JNDIConnectionWrapper.java:502)
        at org.apache.directory.studio.ldapbrowser.core.jobs.ImportLdifJob.importLdifRecord(ImportLdifJob.java:507)
        at org.apache.directory.studio.ldapbrowser.core.jobs.ImportLdifJob.importLdif(ImportLdifJob.java:267)
        at org.apache.directory.studio.ldapbrowser.core.jobs.ExecuteLdifRunnable.run(ExecuteLdifRunnable.java:143)
        at org.apache.directory.studio.ldapbrowser.core.jobs.UpdateEntryRunnable.run(UpdateEntryRunnable.java:58)
        at org.apache.directory.studio.connection.ui.RunnableContextRunner$1.run(RunnableContextRunner.java:113)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

      [LDAP: error code 21 - INVALID_ATTRIBUTE_SYNTAX: failed for MessageType : MODIFY_REQUEST
      Message ID : 19
      Modify Request
      Object : 'cn=test,dc=openengsb,dc=org'
      Modification[0]
      Operation : add
      Modification
      jpegPhoto: '0xFF 0xD8 0xFF 0xE1 0x00 0x18 0x45 0x78 0x69 0x66 0x00 0x00 0x49 0x49 0x2A 0x00 ...'
      org.apache.directory.shared.ldap.model.message.ModifyRequestImpl@6e3926ee: ERR_04447_CANNOT_NORMALIZE_VALUE Cannot normalize the wrapped value ERR_04473_NOT_VALID_VALUE Not a valid value '[B@1ff6c2a9' for the AttributeType 'ATTRIBUTE_TYPE ( 0.9.2342.19200300.100.1.60
      NAME 'jpegPhoto'
      DESC RFC2798: a JPEG image
      SYNTAX 1.3.6.1.4.1.1466.115.121.1.28
      USAGE userApplications
      )
      ']

      1. test2.ldif
        38 kB
        Sander Maijers
      2. testimage.jpg
        28 kB
        Sander Maijers
      3. test-image.jpg
        214 kB
        Pierre-Arnaud Marcelot
      4. testimage.jpg.b64
        37 kB
        Sander Maijers

        Activity

        Pierre-Arnaud Marcelot created issue -
        Hide
        Pierre-Arnaud Marcelot added a comment -

        Here's the test-image.

        Show
        Pierre-Arnaud Marcelot added a comment - Here's the test-image.
        Pierre-Arnaud Marcelot made changes -
        Field Original Value New Value
        Attachment test-image.jpg [ 12513144 ]
        Hide
        Pierre-Arnaud Marcelot added a comment -

        Fixed by Emmanuel at revision 1240238.

        http://svn.apache.org/viewvc?rev=1240238&view=rev

        Show
        Pierre-Arnaud Marcelot added a comment - Fixed by Emmanuel at revision 1240238. http://svn.apache.org/viewvc?rev=1240238&view=rev
        Pierre-Arnaud Marcelot made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Emmanuel Lecharny [ elecharny ]
        Resolution Fixed [ 1 ]
        Hide
        Sander Maijers added a comment -

        I still cannot add an entry with a jpegPhoto attribute in ApacheDS 2.0.0-M11. I base64-decoded one such attribute from my LDIF file, and the header bytes in there are proper. So this attribute should pass the JPEG header check. Still I received an attribute error at the first jpegPhoto attribute it encounters when importing this LDIF file. That error was resolved upon removal of all jpegPhoto lines from the LDIF file.

        Show
        Sander Maijers added a comment - I still cannot add an entry with a jpegPhoto attribute in ApacheDS 2.0.0-M11. I base64-decoded one such attribute from my LDIF file, and the header bytes in there are proper. So this attribute should pass the JPEG header check. Still I received an attribute error at the first jpegPhoto attribute it encounters when importing this LDIF file. That error was resolved upon removal of all jpegPhoto lines from the LDIF file.
        Sander Maijers made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Pierre-Arnaud Marcelot added a comment - - edited

        Hi Sander,

        I successfully imported a JPEG photo in ApacheDS 2.0.0-M11 using Apache Directory Studio 2.0.0-M6.
        I tried both scenarios:

        • Creating an entry and importing the JPEG photo in Apache Directory Studio (via menus and wizards)
        • Importing an entry containing a JPEG photo (encoded as BASE64) from an LDIF file.

        Could you provide us your image and/or LDIF please?
        Thanks

        Show
        Pierre-Arnaud Marcelot added a comment - - edited Hi Sander, I successfully imported a JPEG photo in ApacheDS 2.0.0-M11 using Apache Directory Studio 2.0.0-M6. I tried both scenarios: Creating an entry and importing the JPEG photo in Apache Directory Studio (via menus and wizards) Importing an entry containing a JPEG photo (encoded as BASE64) from an LDIF file. Could you provide us your image and/or LDIF please? Thanks
        Hide
        Emmanuel Lecharny added a comment -

        Could you attach the LDIF file with the jpegPhoto you are injecting, so that we can test it ? Thanks !

        Show
        Emmanuel Lecharny added a comment - Could you attach the LDIF file with the jpegPhoto you are injecting, so that we can test it ? Thanks !
        Sander Maijers made changes -
        Attachment test2.ldif [ 12576547 ]
        Attachment testimage.jpg [ 12576548 ]
        Attachment testimage.jpg.b64 [ 12576549 ]
        Hide
        Sander Maijers added a comment - - edited

        I just added test files. I do not know whether this triggers the error message too, because the test LDIF is a heavily minimized test case sample and the JPEG file is different from what I used. (I cannot publish the original data.) I was using ldapmodify when I received the error message. When using the Apache Directory Studio on an existent entry (imported from the original LDIF file with jpegPhoto attributes removed), adding a new jpegPhoto attribute and selecting the test image does not produce an error message. Furthermore the LDIF log of the GUI edit operation indicates that Apache Studio generates the same base64 data for this image as that I used in my test case LDIF file (generated manually).

        Show
        Sander Maijers added a comment - - edited I just added test files. I do not know whether this triggers the error message too, because the test LDIF is a heavily minimized test case sample and the JPEG file is different from what I used. (I cannot publish the original data.) I was using ldapmodify when I received the error message. When using the Apache Directory Studio on an existent entry (imported from the original LDIF file with jpegPhoto attributes removed), adding a new jpegPhoto attribute and selecting the test image does not produce an error message. Furthermore the LDIF log of the GUI edit operation indicates that Apache Studio generates the same base64 data for this image as that I used in my test case LDIF file (generated manually).
        Hide
        Pierre-Arnaud Marcelot added a comment -

        Hi.

        I tested with the latest trunk version of both ApacheDS and Studio, and I successfully added the test image via Apache Directory Studio's Image Editor and via an LDIF import as well...

        I also tested with Apache Directory Studio 2.0.0-M6 and it's also fine.

        Could you give a try to ApacheDS 2.0.0-M12 which was released today?

        Show
        Pierre-Arnaud Marcelot added a comment - Hi. I tested with the latest trunk version of both ApacheDS and Studio, and I successfully added the test image via Apache Directory Studio's Image Editor and via an LDIF import as well... I also tested with Apache Directory Studio 2.0.0-M6 and it's also fine. Could you give a try to ApacheDS 2.0.0-M12 which was released today?
        Hide
        Emmanuel Lecharny added a comment -

        AFAICT, this issue has been fixed in M6, a while back...

        Show
        Emmanuel Lecharny added a comment - AFAICT, this issue has been fixed in M6, a while back...
        Emmanuel Lecharny made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Emmanuel Lecharny
            Reporter:
            Pierre-Arnaud Marcelot
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development