Skip to content

Exception with certain GPS constants #4

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?

Trying to create a GPS exif element with certain constants will throw an 
exception.  These two constants in particular:

TiffOutputField altitudeOutField = 
TiffOutputField.create(TiffConstants.GPS_TAG_GPS_ALTITUDE, outputSet.byteOrder, 
altitude);

TiffOutputField altitudeRefField = 
TiffOutputField.create(TiffConstants.GPS_TAG_GPS_ALTITUDE_REF, 
outputSet.byteOrder, 
GPSTagConstants.GPS_TAG_GPS_ALTITUDE_REF_VALUE_ABOVE_SEA_LEVEL);

Looking in GPSTagConstants.java, it shows these two TagInfo classes are created 
with a length of -1.  The exception generation happens because of this:

TiffOutputField.java:

public static TiffOutputField create(TagInfo tagInfo, int byteOrder,
            Number number) throws ImageWriteException
    {
        if (tagInfo.dataTypes == null || tagInfo.dataTypes.length < 1)
            throw new ImageWriteException("Tag has no default data type.");
        FieldType fieldType = tagInfo.dataTypes[0];

        if (tagInfo.length != 1)
            throw new ImageWriteException("Tag does not expect a single value.");

        byte bytes[] = fieldType.writeData(number, byteOrder);

        return new TiffOutputField(tagInfo.tag, tagInfo, fieldType, 1, bytes);
    }

Since length == -1, the exception is thrown.



What is the expected output? What do you see instead?
Expected output is that this Exif element can be created and added to the 
directory.

What version of the product are you using? On what operating system?
Latest source from subversion.  Android 2.2 on HTC EVO, as well as Android 
2.2.1 on Nexus One.

Please provide any additional information below.
I'm not sure what the -1 corresponds to, or what the length field is.  I could 
try changing the GPSTagConstants.java definition, but I'm not sure of what 
effects this may cause.

Original issue reported on code.google.com by kevin.ta...@gmail.com on 22 Jan 2011 at 3:39

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions