aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java
diff options
context:
space:
mode:
authorHenning Schmiedehausen <henning@schmiedehausen.org>2021-03-02 12:11:22 -0800
committerHenning Schmiedehausen <henning@schmiedehausen.org>2021-03-02 12:11:22 -0800
commit7a3fbd52f480fd29f184039807c3dab2a24f050a (patch)
tree98a1926868124148edae1d1a1c1481374b2076f2 /velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java
parenta9c3432f357b62370992d4698a2f78c97cf484cb (diff)
downloadapache-velocity-engine-7a3fbd52f480fd29f184039807c3dab2a24f050a.tar.gz
Fixes failing tests on JDK 11+
Some brittle code tests the messages of exceptions etc. in the tests which have changed in JDK11+ Tested with OpenJDK 11 and OpenJDK 15.
Diffstat (limited to 'velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java')
-rw-r--r--velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java b/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java
index a006a547..c15b18fc 100644
--- a/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java
+++ b/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java
@@ -305,6 +305,16 @@ public class ConversionHandlerTestCase extends BaseTestCase
Exception e,
Info info)
{
+ // JDK 11+ changed the exception message for big decimal conversion exceptions,
+ // which breaks the (brittle) tests. Clearly, it would be preferred to fix this
+ // right by comparing the result according to the JDK version, this is just a
+ // quick fix to get the build to pass on JDK 11+
+ //
+ if (e.getClass() == NumberFormatException.class && e.getMessage() != null && e.getMessage().startsWith("Character"))
+ {
+ return method + " -> " + e.getClass().getSimpleName() + ": null"; // compatible with JDK8
+ }
+
return method + " -> " + e.getClass().getSimpleName() + ": " + e.getMessage();
}
}