In a capabilities having empty OnlineResource, the following exception is returned:
testEmptyOnlineResource(org.geotools.data.wfs.v1_0_0.ParseCapabilitesTest) Time elapsed: 0.013 sec <<< ERROR!
java.lang.IllegalArgumentException: URI is not absolute
at java.net.URI.toURL(URI.java:1088)
at org.geotools.data.wfs.v1_0_0.xml.WFSCapabilitiesComplexTypes$ServiceType.getValue(WFSCapabilitiesComplexTypes.java:1999)
at org.geotools.xml.handlers.ComplexElementHandler.endElement(ComplexElementHandler.java:188)
at org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:264)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1783)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2970)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
at org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:134)
at org.geotools.data.wfs.v1_0_0.ParseCapabilitesTest.testEmptyOnlineResource(ParseCapabilitesTest.java:53)
eg.
<Service>
<Name>My GeoServer WFS</Name>
<Title>My GeoServer WFS</Title>
<Abstract>
This is a description of your Web Feature Server. </Abstract>
<Keywords>WFS, WMS, GEOSERVER</Keywords>
<!-- Some WFS server (eg. some version of QGISServer)
does not allows to set online resource values
and return an empty one. Tolerate this as this is XSD valid.-->
<OnlineResource></OnlineResource>
The schema define OnlineResource using:
<xsd:element name="OnlineResource"/>
Which means anyType (https://www.w3.org/TR/xmlschema-1/#ur-type-itself) even if the comment refer to an "HTTP URL" and the onlineResource attributes which is a String:
<xsd:attribute name="onlineResource" type="xsd:string" use="required"/>
So empty OnlineResource is XSD valid, but trigger an exception when GT parses it. It may be better to tolerate empty values ? |