Parsing exception in WFS with engineering notation (e) in WKT

Description

When querying the WFS over the greenwich meridian for WFS results with small values, hence MySQL using engineering notation (e-X), we get the following exception
com.vividsolutions.jts.io.ParseException e-14

Server is at http://zsite.space.qinetiq.com:8080/geoserver - http://zsite.space.qinetiq.com:8080/geoserver

Query:

<wfs:GetFeature service="WFS" version="1.0.0"
outputFormat="GML2"
xmlns:midas="http://www.midasweather.org/midas"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd - http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Query typeName="midas:UK_CURRENTS">
<wfsropertyName>midas:magnitude</wfsropertyName>
<wfsropertyName>midas:lat_long</wfsropertyName>
<ogc:Filter>
<ogc:BBOX>
<ogcropertyName>lat_long</ogcropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates>-1.29,49.5 1.4,50.56</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

Exception:

javax.xml.transform.TransformerException: Translator error at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:123) at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:98) at org.vfny.geoserver.responses.wfs.GML2FeatureResponseDelegate.encode(GML2FeatureResponseDelegate.java:219) at org.vfny.geoserver.responses.wfs.FeatureResponse.writeTo(FeatureResponse.java:127) at org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:423) at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:300) at org.vfny.geoserver.servlets.wfs.WfsDispatcher.doResponse(WfsDispatcher.java:245) at org.vfny.geoserver.servlets.wfs.WfsDispatcher.doPost(WfsDispatcher.java:134) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677) at java.lang.Thread.run(Thread.java:534) Caused by: java.lang.RuntimeException: error reading FeatureResults at org.geotools.gml.producer.FeatureTransformer$FeatureTranslator.encode(FeatureTransformer.java:356) at org.geotools.xml.transform.TransformerBase$XMLReaderSupport.parse(TransformerBase.java:605) at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:452) at org.geotools.xml.transform.TransformerBase$Task.run(TransformerBase.java:286) at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:119) ... 48 more Caused by: org.geotools.data.DataSourceException: Could not parse WKT at org.geotools.data.jdbc.attributeio.WKTAttributeIO.read(WKTAttributeIO.java:79) at org.geotools.data.jdbc.QueryData.read(QueryData.java:183) at org.geotools.data.jdbc.JDBCFeatureReader.readFeature(JDBCFeatureReader.java:106) at org.geotools.data.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:86) at org.geotools.data.MaxFeatureReader.next(MaxFeatureReader.java:54) at org.geotools.data.DefaultFeatureResults.getBounds(DefaultFeatureResults.java:166) at org.geotools.gml.producer.FeatureTransformer$FeatureTranslator.encode(FeatureTransformer.java:340) ... 52 more Caused by: com.vividsolutions.jts.io.ParseException: Expected number but encountered word: e-14 at com.vividsolutions.jts.io.WKTReader.getNextNumber(Unknown Source) at com.vividsolutions.jts.io.WKTReader.getPreciseCoordinate(Unknown Source) at com.vividsolutions.jts.io.WKTReader.readPointText(Unknown Source) at com.vividsolutions.jts.io.WKTReader.readGeometryTaggedText(Unknown Source) at com.vividsolutions.jts.io.WKTReader.read(Unknown Source) at com.vividsolutions.jts.io.WKTReader.read(Unknown Source) at org.geotools.data.jdbc.attributeio.WKTAttributeIO.read(WKTAttributeIO.java:75) ... 58 more --------- java.lang.RuntimeException: error reading FeatureResults at org.geotools.gml.producer.FeatureTransformer$FeatureTranslator.encode(FeatureTransformer.java:356) at org.geotools.xml.transform.TransformerBase$XMLReaderSupport.parse(TransformerBase.java:605) at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:452) at org.geotools.xml.transform.TransformerBase$Task.run(TransformerBase.java:286) at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:119) at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:98) at org.vfny.geoserver.responses.wfs.GML2FeatureResponseDelegate.encode(GML2FeatureResponseDelegate.java:219) at org.vfny.geoserver.responses.wfs.FeatureResponse.writeTo(FeatureResponse.java:127) at org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:423) at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:300) at org.vfny.geoserver.servlets.wfs.WfsDispatcher.doResponse(WfsDispatcher.java:245) at org.vfny.geoserver.servlets.wfs.WfsDispatcher.doPost(WfsDispatcher.java:134) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677) at java.lang.Thread.run(Thread.java:534) Caused by: org.geotools.data.DataSourceException: Could not parse WKT at org.geotools.data.jdbc.attributeio.WKTAttributeIO.read(WKTAttributeIO.java:79) at org.geotools.data.jdbc.QueryData.read(QueryData.java:183) at org.geotools.data.jdbc.JDBCFeatureReader.readFeature(JDBCFeatureReader.java:106) at org.geotools.data.jdbc.JDBCFeatureReader.next(JDBCFeatureReader.java:86) at org.geotools.data.MaxFeatureReader.next(MaxFeatureReader.java:54) at org.geotools.data.DefaultFeatureResults.getBounds(DefaultFeatureResults.java:166) at org.geotools.gml.producer.FeatureTransformer$FeatureTranslator.encode(FeatureTransformer.java:340) ... 52 more Caused by: com.vividsolutions.jts.io.ParseException: Expected number but encountered word: e-14 at com.vividsolutions.jts.io.WKTReader.getNextNumber(Unknown Source) at com.vividsolutions.jts.io.WKTReader.getPreciseCoordinate(Unknown Source) at com.vividsolutions.jts.io.WKTReader.readPointText(Unknown Source) at com.vividsolutions.jts.io.WKTReader.readGeometryTaggedText(Unknown Source) at com.vividsolutions.jts.io.WKTReader.read(Unknown Source) at com.vividsolutions.jts.io.WKTReader.read(Unknown Source) at org.geotools.data.jdbc.attributeio.WKTAttributeIO.read(WKTAttributeIO.java:75) ... 58 more

Environment

None

Activity

Show:
codehaus
April 10, 2015, 4:18 PM

CodeHaus Comment From: cholmes - Time: Fri, 4 Feb 2005 12:09:20 -0600
---------------------
<p>Linked to GeoTools issue, where this should be addressed.</p>

codehaus
April 10, 2015, 4:18 PM

CodeHaus Comment From: cholmes - Time: Tue, 22 Feb 2005 15:40:27 -0600
---------------------
<p>Bug fix just went into jts, right? Close this bug when the fix works itself into GeoServer. And Norman, if you need a version sooner we can probably get it to you.</p>

codehaus
April 10, 2015, 4:18 PM

CodeHaus Comment From: dblasby - Time: Tue, 22 Feb 2005 17:47:06 -0600
---------------------
<p>I have already submitted a patch to JTS for this bug. I'm not sure if martin has applied it yet.</p>

<p>If not, it will be soon integrated when the new JTS io routines are added.</p>

<p>This patch hasn't been fully tested:</p>

<p>Here's a patch WKTReader.getNextNumber(): line 208. Replace the

switch statement for "case StreamTokenizer.TT_NUMBER:" with the

include block.</p>

<p>// peak ahead - if the next letter is an "e", then assume its in

exponential notation.

case StreamTokenizer.TT_NUMBER:

{

//check to see if this is in eponential notation

double numb= tokenizer.nval;

int next_token = tokenizer.nextToken();

if (next_token ==StreamTokenizer.TT_WORD )

{

char nextLetter = tokenizer.sval.charAt(0);

if ( (nextLetter == 'e' ) || (nextLetter == 'E' ) )</p>
{
String exp = tokenizer.sval.substring(1);

return numb * Math.pow(10, Double.parseDouble(exp));
}
<p> else</p>
{
tokenizer.pushBack(); // its not exponential notation
return tokenizer.nval;
}
<p> }

else</p>
{
tokenizer.pushBack(); //normal case
return tokenizer.nval;
}
<p> }</p>

codehaus
April 10, 2015, 4:18 PM

CodeHaus Comment From: dblasby - Time: Tue, 17 May 2005 16:52:52 -0500
---------------------
<p>I fixed this is JTS</p>

codehaus
April 10, 2015, 4:18 PM

CodeHaus Comment From: aaime - Time: Thu, 29 Mar 2007 02:06:02 -0500
---------------------
<p>These issue has been in resolved state for at least one month (quite a bit, a lot more than one month). Batch transitioning them to closed state</p>

Fixed

Assignee

Unassigned

Reporter

codehaus

Triage

None

Fix versions

Affects versions

Components

Priority

Medium
Configure