Revision 41301 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/wfs/WFSProtocolHandlerFactory.java
WFSProtocolHandlerFactory.java | ||
---|---|---|
41 | 41 |
import org.gvsig.remoteclient.utils.CapabilitiesTags; |
42 | 42 |
import org.gvsig.remoteclient.utils.EncodingXMLParser; |
43 | 43 |
import org.gvsig.remoteclient.utils.Utilities; |
44 |
import org.slf4j.Logger; |
|
45 |
import org.slf4j.LoggerFactory; |
|
44 | 46 |
|
45 | 47 |
/** |
46 | 48 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
47 | 49 |
*/ |
48 | 50 |
public class WFSProtocolHandlerFactory { |
49 |
public WFSProtocolHandler wFSProtocolHandler; |
|
51 |
private static Logger logger = LoggerFactory.getLogger(WFSProtocolHandlerFactory.class); |
|
52 |
|
|
53 |
public WFSProtocolHandler wFSProtocolHandler; |
|
50 | 54 |
private static final StringUtils stringUtils = CompatLocator.getStringUtils(); |
51 | 55 |
private static ArrayList supportedVersions = new ArrayList(); |
52 | 56 |
|
... | ... | |
152 | 156 |
} |
153 | 157 |
catch(Exception e) |
154 | 158 |
{ |
155 |
e.printStackTrace();
|
|
159 |
logger.warn("Can't negotiate version for host '"+host+"'.",e);
|
|
156 | 160 |
return null; |
157 | 161 |
} |
158 | 162 |
} |
... | ... | |
169 | 173 |
String request = WFSProtocolHandler.buildCapabilitiesSuitableVersionRequest(host, _version); |
170 | 174 |
String version = new String(); |
171 | 175 |
Reader reader = null; |
176 |
File file = null; |
|
172 | 177 |
try { |
173 |
File file = Utilities.downloadFile(new URL(request), "wfs-suitable-version", null);
|
|
178 |
file = Utilities.downloadFile(new URL(request), "wfs-suitable-version", null); |
|
174 | 179 |
|
175 | 180 |
reader = new FileReader(file); |
176 | 181 |
EncodingXMLParser kxmlParser = new EncodingXMLParser(); |
... | ... | |
193 | 198 |
} catch(IOException ioEx) { |
194 | 199 |
throw new IOException(ioEx.getMessage()); |
195 | 200 |
} catch(XmlPullParserException xmlEx) { |
196 |
xmlEx.printStackTrace(); |
|
201 |
String fname = ""; |
|
202 |
if( file != null ) { |
|
203 |
fname = file.getAbsolutePath(); |
|
204 |
} |
|
205 |
logger.warn("Can't get suitable WFS version for host '"+host+"' from file '"+fname+"'.",xmlEx); |
|
197 | 206 |
return ""; |
198 | 207 |
} finally { |
199 | 208 |
if (reader != null) { |
200 | 209 |
try { |
201 | 210 |
reader.close(); |
202 | 211 |
} catch(Exception ex) { |
203 |
ex.printStackTrace();
|
|
212 |
logger.warn("Can't close reader.",ex);
|
|
204 | 213 |
} |
205 | 214 |
} |
206 | 215 |
} |
... | ... | |
244 | 253 |
driver = Class.forName("org.gvsig.remoteclient.wfs.wfs_"+version+".WFSProtocolHandler" + version); |
245 | 254 |
return (WFSProtocolHandler)driver.newInstance(); |
246 | 255 |
} catch (Exception e) { |
247 |
e.printStackTrace(); |
|
248 |
//throw new Exception("WFSDriverFactory. Unknown driver version " + e); |
|
256 |
logger.warn("Can't create driver for WFS version '"+version+"'.",e); |
|
249 | 257 |
return null; |
250 | 258 |
} |
251 | 259 |
} |
Also available in: Unified diff