<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello Emmanuel<br>
<br>
I just had a look in the code. I saw a hard-coded timeout of 10
seconds in the <tt>WebFeatureClient</tt> class (line 154 and 158).
Would it be possible that the server queried by your application
take more than 10 seconds to answer?<br>
<br>
Hello Johann<br>
<br>
I case of timeout, the <tt>WebFeatureClient.getCapabilities()</tt>
method at line 159 logs a warning and returns null. However the
Javadoc does not said that this method may return null, and indeed
the <tt>WFSFeatureStore.checkTypeExists()</tt> method at line 114
does not verify if the <tt>WFSCapabilities</tt> object is null,
which causes the <tt>NullPointerException</tt>. What would be the
appropriate behaviour?<br>
<br>
<ul>
<li>In case of failure, let <tt>WebFeatureClient</tt> throws an
exception? (my preferred choice, since otherwise we get a <tt>NullPointerException</tt>
anyway, which is much less informative).</li>
<li>In case of failure, have <tt>WebFeatureClient</tt> to return
an empty <tt>WFSCapabilities</tt>? (I don't think it would be
safe, since the caller does not know that there is a problem).</li>
<li>Document that <tt>WebFeatureClient.getCapabilities()</tt> may
return null in case of failure, and revisit all caller code for
making them null-safe?<br>
</li>
</ul>
<br>
Martin<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">Le 09/12/14 07:18, Emmanuel Blondel a
écrit :<br>
</div>
<blockquote cite="mid:5486239A.9080005@gmail.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Hello,<br>
<br>
I'm currently assessing the WFS client from Geotoolkit. We would
like to use it in a new project (also because we would like to use
Apache SIS progressively), with the purpose to discover
featuretypes and fetch the featureCollection data, relying on the
official GeoAPI.<br>
<br>
I've been trying to use Geotoolkit 4.0-M2 (which AFAIK is the
latest milestone release), and the geotk-wfs-client.<br>
<br>
I get the following stack trace :<br>
<br>
<i>déc. 08, 2014 11:11:58 PM
org.geotoolkit.data.wfs.WebFeatureClient getCapabilities</i><i><br>
</i><i>AVERTISSEMENT: TimeOut error, the server takes too much
time to answer. </i><i><br>
</i><i>Exception in thread "main" java.lang.NullPointerException</i><i><br>
</i><i> at
org.geotoolkit.data.wfs.WFSFeatureStore.checkTypeExist(WFSFeatureStore.java:114)</i><i><br>
</i><i> at
org.geotoolkit.data.wfs.WFSFeatureStore.<init>(WFSFeatureStore.java:107)</i><i><br>
</i><i> at org.fao.fi.wfstesting.App.main(App.java:33)</i><br>
<br>
<br>
for this code:<br>
<br>
final WebFeatureClient wfsServer = new
WebFeatureClient(new URL(<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://www.fao.org/figis/geoserver/ows">"http://www.fao.org/figis/geoserver/ows"</a>),
"1.1.0");<br>
final GetCapabilitiesRequest getCapa =
wfsServer.createGetCapabilities();<br>
<br>
final GetFeatureRequest getFeature =
wfsServer.createGetFeature();<br>
//simplify WFS like a datastore<br>
final FeatureStore store = new WFSFeatureStore(wfsServer);<br>
<br>
String[] typeNames = store.getTypeNames();<br>
for(String typeName : typeNames){<br>
FeatureType ft = store.getFeatureType(typeName);<br>
System.out.println(ft.getName());<br>
System.out.println("==");<br>
}<br>
<br>
I admit i'm lost. I had a look to the code for which i identified
the timeout warning.<br>
But nothing about the exception. Any idea?<br>
<br>
Thanks in advance for your help<br>
Emmanuel<br>
</blockquote>
<br>
</body>
</html>