commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lulu winlumski (JIRA)" <>
Subject [jira] Created: (SANSELAN-31) Typesafe, high-level API for setting EXIF fields
Date Tue, 20 Oct 2009 18:17:59 GMT
Typesafe, high-level API for setting EXIF fields

                 Key: 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.

View raw message