directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <directory-...@incubator.apache.org>
Subject [jira] Commented: (DIREVE-163) Putting a jpeg picture in the inetOrgPerson jpegPhoto attribute alter the bytes datas of the picture
Date Wed, 31 Aug 2005 06:28:05 GMT
    [ http://issues.apache.org/jira/browse/DIREVE-163?page=comments#action_12320672 ] 

Emmanuel Lecharny commented on DIREVE-163:
------------------------------------------

Attribute values are generally stored as String. This is a major problem for binary attributes,
as we loose information (jpegPhoto for instance).

here is an exemple of code where this problem occurs :
org.apache.ldap.common.berlib.asn1.decoder.compare.CompareAVARule {
...


    public void finish()
    {
        // pop the ByteBuffer the super method pushed
        ByteBuffer buf = ( ByteBuffer ) getDigester().pop() ;
        // peek at the CompareRequest underneath whose name we set
        CompareRequest req = ( CompareRequest ) getDigester().peek() ;

        byte[] octets = null ;
        if ( buf.limit() == buf.capacity() && buf.hasArray() )
        {
            // use the backing store
            octets = buf.array() ;
        }
        else
        {
            // copy because we don't have accessible array or data < array
            octets = new byte[buf.remaining()] ;
            buf.get( octets ) ;
        }

        if ( req.getAttributeId() == null )
        {
            req.setAttributeId( new String( octets ) ) ;
        }
        else
        {
            req.setAssertionValue( new String( octets ) ) ;
        }
    }


The "new String(octets)" is destructing when applied to binary values.


> Putting a jpeg picture in the inetOrgPerson jpegPhoto attribute alter the bytes datas
of the picture
> ----------------------------------------------------------------------------------------------------
>
>          Key: DIREVE-163
>          URL: http://issues.apache.org/jira/browse/DIREVE-163
>      Project: Directory Server
>         Type: Bug
>     Versions: 0.9
>  Environment: Windows XP SP2
> JRE 1.5
> Built with Netbeans 4.0
> Mevenide.
>     Reporter: Tony Blanchard
>     Priority: Minor
>      Fix For: 0.9.3
>  Attachments: BinaryTest.java
>
> All the picture byte values like those (-113 , -115, -112, -127 and -99) are changed
to the "63" value when reading jpeg datas. "-39" value is changed to "0".
> This is on my jpeg sample picture but I think there is enought datas to be representative.
> I have tried to put a picture with JXplorer and my own client program. The same thing
happens...
> Seems to be a server problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message