Bug 32692 - Extension.getCompatibilityWith contains broken logic
Summary: Extension.getCompatibilityWith contains broken logic
Status: RESOLVED DUPLICATE of bug 31360
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.6.2
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2004-12-14 12:24 UTC by Ovidiu Cernautan
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ovidiu Cernautan 2004-12-14 12:24:42 UTC
The Extension class contains two logic errors in the getCompatibilityWith method.

Both checks, for Specification Version and for Implementation Version contains
the same error (I think it is caused by an automatic refactor action). Both
checks should imply the comparison of the currect Extension
specification/implementation version with the one suplied in the Extension
parameter.

Current code 1:
        // Available specification version must be >= required
        final DeweyDecimal specificationVersion
            = required.getSpecificationVersion();
        if (null != specificationVersion) {
            if (null == specificationVersion
                || !isCompatible(specificationVersion, specificationVersion)) {
                return REQUIRE_SPECIFICATION_UPGRADE;
            }
        }

Fixed code 1:
        final DeweyDecimal specificationVersion
            = required.getSpecificationVersion();
        if (null != specificationVersion) {
            if (null == this.specificationVersion
                || !isCompatible(this.specificationVersion, specificationVersion)) {
                return REQUIRE_SPECIFICATION_UPGRADE;
            }
        }

Current code 2:
        // Implementation version must be >= required
        final DeweyDecimal implementationVersion
            = required.getImplementationVersion();
        if (null != implementationVersion) {
            if (null == implementationVersion
                || !isCompatible(implementationVersion, implementationVersion)) {
                return REQUIRE_IMPLEMENTATION_UPGRADE;
            }
        }

Fixed code 2:
        // Implementation version must be >= required
        final DeweyDecimal implementationVersion
            = required.getImplementationVersion();
        if (null != implementationVersion) {
            if (null == this.implementationVersion
                || !isCompatible(this.implementationVersion,
implementationVersion)) {
                return REQUIRE_IMPLEMENTATION_UPGRADE;
            }
        }
Comment 1 Matt Benson 2004-12-14 17:11:43 UTC

*** This bug has been marked as a duplicate of 31360 ***