I was just looking at the Boolean function (and the other functions like
min that force things to double) and deciding they could be a little more
relaxed:

https://github.com/geotools/geotools/blob/main/modules/library/main/src/main/java/org/geotools/data/util/BooleanConverterFactory.java

If you would like to work on the converter I would be happy to review your
pull request.  I do encourage you to report this issue (if it has not
already been done).

Jody

On Thu, Dec 2, 2021 at 9:13 AM Leif Eirik Lislegård <
leif.eirik.lisleg...@kartverket.no> wrote:

> Hello devs,
>
>
> I'm currently migrating a WFS service to Geoserver 2.20 (from 2.7) and ran
> into a mapping issue. The exception presented was
> "java.lang.ClassCastException: class java.math.BigDecimal cannot be cast to
> class java.lang.Boolean".
>
> After some digging I found that Oracle JDBC driver always returns
> BigDecimal for its database number types where boolean fields are modeled
> as "number(1)". This is the oracle convention.
> The way mapping can be leveraged in GeoTools seems to be by registering a
> ConverterFactory using the ServiceLoader in Java.
>
> The quick fix in my case was to add a custom converter to the classpath.
>
> I realize there's an existing factory doing Boolean conversion which might
> be a natural candidate.
>
> I am wondering if GT would welcome such a change:
> https://github.com/lislei/geotools/commits/GML_BigDecimal_to_Boolean
>
>
>
>
>
>
> Best regards,
> Leif Lislegård
> _______________________________________________
> GeoTools-Devel mailing list
> GeoTools-Devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
-- 
--
Jody Garnett
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to