DataUtilities isMatch method wrongly implemented

Description

Method <b>org.geotools.data.DataUtilties.isMatch(AttributeDescriptor a, AttributeDescriptor b)</b> is erroneous.
Source of the problem is the last 2 if statements

// Some comments here
isMatch(AttributeDescriptor a, AttributeDescriptor b) {
...
(a.equals(b)) {
;
}

(a.getLocalName().equals(b.getLocalName()) &amp;&amp; a.getClass().equals(b.getClass())) {
;
}
}

The last if statement is wrong since the second part of equality actually compares always two AttributeDescriptor classes. Probably it should be replaced by a attribute type binding comparison. As it is now it will return true if i.e. you compare 2 geometry attributes of the same name but where the one is a polygon and the other a point.
Moreover the previous if statement should be negated and return false so that if a false is found we do not proceed further.
Proposed fix is to transform the method as follows:

isMatch(AttributeDescriptor a, AttributeDescriptor b) {
(a == b) {
;
}

) {
;
}

) {
;
}

(!(a.getLocalName().equals(b.getLocalName()) &amp;&amp; a.getType().getBinding().equals(b.getType().getBinding()))) {
;
}

(!a.equals(b)) {
;
}

;
}

Environment

None

Assignee

Unassigned

Reporter

codehaus

Triage

None

Fix versions

Affects versions

Priority

Medium
Configure