Fix for bug 46613 - evaluator should perform case insensitive string comparisons
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@738188 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c3258085c7
commit
0b692dd75c
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
<!-- Don't forget to update status.xml too! -->
|
<!-- Don't forget to update status.xml too! -->
|
||||||
<release version="3.5-beta5" date="2008-??-??">
|
<release version="3.5-beta5" date="2008-??-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">46613 - Fixed evaluator to perform case insensitive string comparisons</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">46544 - command line interface for hssf ExcelExtractor</action>
|
<action dev="POI-DEVELOPERS" type="add">46544 - command line interface for hssf ExcelExtractor</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46547 - Allow addition of conditional formatting after data validation</action>
|
<action dev="POI-DEVELOPERS" type="fix">46547 - Allow addition of conditional formatting after data validation</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46548 - Page Settings Block fixes - continued PLS records and PSB in sheet sub-streams</action>
|
<action dev="POI-DEVELOPERS" type="fix">46548 - Page Settings Block fixes - continued PLS records and PSB in sheet sub-streams</action>
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
<!-- Don't forget to update changes.xml too! -->
|
<!-- Don't forget to update changes.xml too! -->
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.5-beta5" date="2008-??-??">
|
<release version="3.5-beta5" date="2008-??-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">46613 - Fixed evaluator to perform case insensitive string comparisons</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">46544 - command line interface for hssf ExcelExtractor</action>
|
<action dev="POI-DEVELOPERS" type="add">46544 - command line interface for hssf ExcelExtractor</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46547 - Allow addition of conditional formatting after data validation</action>
|
<action dev="POI-DEVELOPERS" type="fix">46547 - Allow addition of conditional formatting after data validation</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46548 - Page Settings Block fixes - continued PLS records and PSB in sheet sub-streams</action>
|
<action dev="POI-DEVELOPERS" type="fix">46548 - Page Settings Block fixes - continued PLS records and PSB in sheet sub-streams</action>
|
||||||
|
@ -97,7 +97,7 @@ public abstract class RelationalOperationEval implements OperationEval {
|
|||||||
if (vb instanceof StringEval) {
|
if (vb instanceof StringEval) {
|
||||||
StringEval sA = (StringEval) va;
|
StringEval sA = (StringEval) va;
|
||||||
StringEval sB = (StringEval) vb;
|
StringEval sB = (StringEval) vb;
|
||||||
return sA.getStringValue().compareTo(sB.getStringValue());
|
return sA.getStringValue().compareToIgnoreCase(sB.getStringValue());
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import junit.framework.TestCase;
|
|||||||
import org.apache.poi.hssf.record.formula.functions.EvalFactory;
|
import org.apache.poi.hssf.record.formula.functions.EvalFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for unary plus operator evaluator.
|
* Test for {@link EqualEval}
|
||||||
*
|
*
|
||||||
* @author Josh Micich
|
* @author Josh Micich
|
||||||
*/
|
*/
|
||||||
@ -66,4 +66,29 @@ public final class TestEqualEval extends TestCase {
|
|||||||
}
|
}
|
||||||
assertTrue(be.getBooleanValue());
|
assertTrue(be.getBooleanValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for bug 46613 (observable at svn r737248)
|
||||||
|
*/
|
||||||
|
public void testStringInsensitive_bug46613() {
|
||||||
|
if (!evalStringCmp("abc", "aBc", EqualEval.instance)) {
|
||||||
|
throw new AssertionFailedError("Identified bug 46613");
|
||||||
|
}
|
||||||
|
assertTrue(evalStringCmp("abc", "aBc", EqualEval.instance));
|
||||||
|
assertTrue(evalStringCmp("ABC", "azz", LessThanEval.instance));
|
||||||
|
assertTrue(evalStringCmp("abc", "AZZ", LessThanEval.instance));
|
||||||
|
assertTrue(evalStringCmp("ABC", "aaa", GreaterThanEval.instance));
|
||||||
|
assertTrue(evalStringCmp("abc", "AAA", GreaterThanEval.instance));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean evalStringCmp(String a, String b, OperationEval cmpOp) {
|
||||||
|
Eval[] args = {
|
||||||
|
new StringEval(a),
|
||||||
|
new StringEval(b),
|
||||||
|
};
|
||||||
|
Eval result = cmpOp.evaluate(args, 10, (short)20);
|
||||||
|
assertEquals(BoolEval.class, result.getClass());
|
||||||
|
BoolEval be = (BoolEval) result;
|
||||||
|
return be.getBooleanValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user