You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Lulu winlumski (JIRA)" <ji...@apache.org> on 2009/10/20 20:17:59 UTC

[jira] Created: (SANSELAN-31) Typesafe, high-level API for setting EXIF fields

Typesafe, high-level API for setting EXIF fields
------------------------------------------------

                 Key: SANSELAN-31
                 URL: https://issues.apache.org/jira/browse/SANSELAN-31
             Project: Commons Sanselan
          Issue Type: Improvement
    Affects Versions: 0.94-incubator
         Environment: all
            Reporter: Lulu winlumski
             Fix For: 0.94-incubator


The current EXIF API is extremely awkward to use. 

I. API is not typesafe and poorly documented.
Currently you have two options:
1) Pass values for EXIF tags as java.lang.Object (TiffOutputField.create)
2) Pass values for EXIF tags as byte arrays (new TiffOutputField())
In the first case, there is no way of knowing what kind of Object is required except looking at the sanselan source or using reflection. 
In the second case, a large part of the implementation of the EXIF specification remains with the client. 
Even if one uses the Object-based API one has to pass around byteorders and needs to null-terminate strings, which is something that would typically be handled by the library layer and not by the client.
A usable API should throw a compile time error when a value is passed that has an incorrect type. This can be achieved either by subclassing TiffOutputField or by using generics.

II. Code clarity
A TiffOutputField is essentially nothing more than a TagInfo + a value. Than why don't you have a constructor TiffOutputField(TagInfo tag, bytes) ?
Instead you need to do:
new TiffOutputField(tag, tag.dataTypes[0], tag.length, bytes);

III. Code correctness
Most of e. g. the GPS tags simply do not work:
GPS_TAG_GPS_VERSION_ID: TiffOutputField.create() fails with ImageWriteException
GPS_TAG_GPS_MAP_DATUM: TiffOutputField.create() fails b/o bug Sanselan-12
GPS_TAG_GPS_ALTITUDE_REF: TiffOutputField.create() fails b/o length -1
GPS_TAG_GPS_ALTITUDE: TiffOutputField.create() fails b/o length -1
GPS_TAG_GPS_DATE_STAMP: TiffOutputField.create() fails b/o bug Sanselan-12
This is not 0.94 code quality but 0.01.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SANSELAN-31) Typesafe, high-level API for setting EXIF fields

Posted by "Charles Matthew Chen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANSELAN-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12767906#action_12767906 ] 

Charles Matthew Chen commented on SANSELAN-31:
----------------------------------------------

I agree... this feature needs to be improved.

> Typesafe, high-level API for setting EXIF fields
> ------------------------------------------------
>
>                 Key: SANSELAN-31
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-31
>             Project: Commons Sanselan
>          Issue Type: Improvement
>    Affects Versions: 0.94-incubator
>         Environment: all
>            Reporter: Lulu winlumski
>             Fix For: 0.94-incubator
>
>
> The current EXIF API is extremely awkward to use. 
> I. API is not typesafe and poorly documented.
> Currently you have two options:
> 1) Pass values for EXIF tags as java.lang.Object (TiffOutputField.create)
> 2) Pass values for EXIF tags as byte arrays (new TiffOutputField())
> In the first case, there is no way of knowing what kind of Object is required except looking at the sanselan source or using reflection. 
> In the second case, a large part of the implementation of the EXIF specification remains with the client. 
> Even if one uses the Object-based API one has to pass around byteorders and needs to null-terminate strings, which is something that would typically be handled by the library layer and not by the client.
> A usable API should throw a compile time error when a value is passed that has an incorrect type. This can be achieved either by subclassing TiffOutputField or by using generics.
> II. Code clarity
> A TiffOutputField is essentially nothing more than a TagInfo + a value. Than why don't you have a constructor TiffOutputField(TagInfo tag, bytes) ?
> Instead you need to do:
> new TiffOutputField(tag, tag.dataTypes[0], tag.length, bytes);
> III. Code correctness
> Most of e. g. the GPS tags simply do not work:
> GPS_TAG_GPS_VERSION_ID: TiffOutputField.create() fails with ImageWriteException
> GPS_TAG_GPS_MAP_DATUM: TiffOutputField.create() fails b/o bug Sanselan-12
> GPS_TAG_GPS_ALTITUDE_REF: TiffOutputField.create() fails b/o length -1
> GPS_TAG_GPS_ALTITUDE: TiffOutputField.create() fails b/o length -1
> GPS_TAG_GPS_DATE_STAMP: TiffOutputField.create() fails b/o bug Sanselan-12
> This is not 0.94 code quality but 0.01.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.