Ben Caradoc-Davies created GEOT-4103:
----------------------------------------
Summary: Can't select last character with OCQL strSubstring()
Key: GEOT-4103
URL: https://jira.codehaus.org/browse/GEOT-4103
Project: GeoTools
Issue Type: Bug
Components: main
Affects Versions: 8.0-RC1
Reporter: Ben Caradoc-Davies
Assignee: Jody Garnett
Fix For: 2.7.5, 8.0-RC1
-------- Original Message --------
Subject: Re: [Siss] Cant select last character with OCQL strSubstring(), bug?
Date: Fri, 13 Apr 2012 09:41:50 +0800
From: Ben Caradoc-Davies
To: Geoff Williams
CC: siss list
Geoff,
this is a bug in GeoTools gt-main StaticGeometry:
http://svn.osgeo.org/geotools/trunk/modules/library/main/src/main/java/org/geotools/filter/function/StaticGeometry.java
In StaticGeometry at line 551 is the following:
if (beg < 0 || end < 0 || beg >= s1.length() || end >= s1.length())
return null;
This is an off-by-one error as it is valid for end to be equal to be
length of the string. The last clause should be "end > s1.length()".
Thanks for the bug report. I will submit a patch to the module maintainer.
Kind regards,
-------- Original Message --------
Subject: [Siss] Cant select last character with OCQL strSubstring(), bug?
Date: Fri, 13 Apr 2012 09:25:55 +0800
From: Geoff Williams
To: siss list
Hi All,
I think I may have found a bug with strSubstring() when used in <OCQL> tags.
In nutshell, I'm unable to select the last character in a string. EG a mapping
file containing:
<AttributeMapping>
<targetAttribute>gml:description</targetAttribute>
<sourceExpression>
<OCQL>strSubstring('ABCD',0,4)</OCQL>
</sourceExpression>
</AttributeMapping>
Does not produce the gml:description element in the output (because the value
coming back from strSubstring is null I assume). I would have expected the
output here to have contained:
<gml:description>ABCD</gml:description>
Which is analogous to the Java code:
"ABCD".substring(0,4);
Which returns "ABCD"
Whereas:
<AttributeMapping>
<targetAttribute>gml:description</targetAttribute>
<sourceExpression>
<OCQL>strSubstring('ABCD',0,3)</OCQL>
</sourceExpression>
</AttributeMapping>
Produces an output containing:
<gml:description>ABC</gml:description>
As expected.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel