Thanks Jody, that would be great.

I've created https://github.com/geotools/geotools/pull/3698 that passes the CI 
tests.

/Leif


Fra: Jody Garnett <jody.garn...@gmail.com>
Sendt: lørdag 4. desember 2021 08:21
Til: Leif Eirik Lislegård <leif.eirik.lisleg...@kartverket.no>
Kopi: GeoTools Developers <geotools-devel@lists.sourceforge.net>
Emne: Re: [Geotools-devel] xs:boolean feature mapping error on WFS/GML3+ using 
Oracle db

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<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgeotools%2Fgeotools%2Fblob%2Fmain%2Fmodules%2Flibrary%2Fmain%2Fsrc%2Fmain%2Fjava%2Forg%2Fgeotools%2Fdata%2Futil%2FBooleanConverterFactory.java&data=04%7C01%7CLeif.Eirik.Lislegard%40kartverket.no%7C919136deb0304ccbcb2b08d9b6f6b731%7C7f74c8a243ce46b2b0e8b6306cba73a3%7C0%7C0%7C637741993021121858%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=c%2BOXDZsTHESEFT2RGF3oKtlACCVCVKvMTeplRXjGiT4%3D&reserved=0>

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<mailto: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<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flislei%2Fgeotools%2Fcommits%2FGML_BigDecimal_to_Boolean&data=04%7C01%7CLeif.Eirik.Lislegard%40kartverket.no%7C919136deb0304ccbcb2b08d9b6f6b731%7C7f74c8a243ce46b2b0e8b6306cba73a3%7C0%7C0%7C637741993021121858%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=w41Wl%2BVN657sBHIQ2cXeSfrsl0WJ%2B7YY9WqzJPKBl7w%3D&reserved=0>



Best regards,
Leif Lislegård
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net<mailto:GeoTools-Devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-devel<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fgeotools-devel&data=04%7C01%7CLeif.Eirik.Lislegard%40kartverket.no%7C919136deb0304ccbcb2b08d9b6f6b731%7C7f74c8a243ce46b2b0e8b6306cba73a3%7C0%7C0%7C637741993021121858%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=mvrwe6sv11DQIw9QQtq8jLY%2F8gRe9Hmug4u4NTapdvQ%3D&reserved=0>
--
--
Jody Garnett
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to