Bug 32692

Summary: Extension.getCompatibilityWith contains broken logic
Product: Ant Reporter: Ovidiu Cernautan <cernautan>
Component: Optional TasksAssignee: Ant Notifications List <notifications>
Status: RESOLVED DUPLICATE    
Severity: major Keywords: PatchAvailable
Priority: P2    
Version: 1.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

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 ***