Skip to content

checkFeatureSupport version comparison #23

@douglove

Description

@douglove

I am using version 10.01 of exiftool.
I constructed the ExifTool with Feature.STAY_OPEN.
The version compare section of the checkFeatureSupport method uses a string compare and it returns false for supported.
Please change the versions to double or float for the comparison.

Existing code
if (ver != null && ver.compareTo(feature.version) >= 0) {
supported = Boolean.TRUE;
log("\t\tFound ExifTool version %s, feature %s is SUPPORTED.",
ver, feature);
} else {
supported = Boolean.FALSE;
log("\t\tFound ExifTool version %s, feature %s is NOT SUPPORTED.",
ver, feature);
}

My solution
if(ver != null){
double verDouble = Double.parseDouble(ver);
double featureVerDouble = Double.parseDouble(feature.version);

            if(verDouble >= featureVerDouble){
                supported = Boolean.TRUE;
                log("\t\tFound ExifTool version %s, feature %s is SUPPORTED.",
                    ver, feature);
            }else {
                supported = Boolean.FALSE;
                log("\t\tFound ExifTool version %s, feature %s is NOT SUPPORTED.",
                        ver, feature);
            }
        } else {
            supported = Boolean.FALSE;
            log("\t\tFound ExifTool version %s, feature %s is NOT SUPPORTED.",
                    ver, feature);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions