poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 57475] New: The Match function does not perform implicit conversion
Date Wed, 21 Jan 2015 14:37:48 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=57475

            Bug ID: 57475
           Summary: The Match function does not perform implicit
                    conversion
           Product: POI
           Version: 3.9-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: cquezel@gmail.com

If I call MATCH (EQUIV) with a SearchCriterion whose type is different from the
type of the elements of the LookupArray, the function returns N/A even if the
types are convertable.


if SearchCriterion is of type string whose value is convertable to a number
('1' for example) and LookupArray contains elements whose type is Number
({1,2,3} for example) then Match returns N/A while Excel and LibreOffice find a
match.


public final class Match extends Var2or3ArgFunction {
...
private static int findIndexOfValue(ValueEval lookupValue, ValueVector
lookupRange,
            boolean matchExact, boolean findLargestLessThanOrEqual) throws
EvaluationException {

...            
    // Next line return false when classes dont match
    if(lookupComparer.compareTo(lookupRange.getItem(i)).isEqual()) {

Because ...

        public final CompareResult compareTo(ValueEval other) {
...
            // Next line does not convert
            if (_targetClass != other.getClass()) {
                return CompareResult.TYPE_MISMATCH;
            }
            return compareSameType(other);
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message