[webservices] Java Webservice Bug

Yazan Suleiman yazan at iris.washington.edu
Tue May 6 11:12:32 PDT 2014


Hello Benjamin

Thank you for reporting this problem.  We will be releasing a new version to address this bug.  Are you using the toString() method to view the object attributes or are you doing further  parsing of the result?  Thanks



On May 6, 2014, at 8:48 AM, Benjamin Sick <benjamin.sick at geophys.uni-stuttgart.de> wrote:

> Hello,
> 
> I discovered a bug in the IRIS webservice Java API library if the
> endDate of a station is not set.
> 
> This happens e.g. with the following query on the Geofon FDSN server:
> http://geofon.gfz-potsdam.de/fdsnws/station/1/query?net=GE&sta=STU&cha=BHZ&loc=--&starttime=2014-04-10T00:00:00&endtime=2014-04-10T00:10:00&level=channel
> 
> Channel part of output from Geofon:
> <Channel code="BHZ" startDate="2000-01-01T00:00:00"
> restrictedStatus="open" locationCode="">
> 
> 
> The IRIS webservice returns a endDate with year 2599:
> http://service.iris.edu/fdsnws/station/1/query?net=GE&sta=STU&cha=BHZ&loc=--&starttime=2014-04-10T00:00:00&endtime=2014-04-10T00:10:00&level=channel
> 
> Channel part of output from IRIS:
> <Channel locationCode=" " startDate="2000-01-01T00:00:00"
> restrictedStatus="open" endDate="2599-12-31T23:59:59" code="BHZ">
> 
> The problem is, that later in the class
> edu.iris.dmc.extensions.entities.MetaData, the method toString() calls
> SimpleDateFormat.format(endDate) where endDate is null which raises a
> NullPointerException.
> 
> A simple fix would be to replace:
> sb.append(sdf.format(startDate) + "," + sdf.format(endDate) + "\n");
> 
> With:
> if (startDate != null) {
> sb.append(sdf.format(startDate));
> if (endDate != null) {
> sb.append(",");
> }
> }
> if (endDate != null) {
> sb.append(sdf.format(endDate));
> }
> sb.append("\n");
> 
> The XML schema of FDSN does not require the endDate to be set (thanks
> to Andres Heinloo for that):
> $ xmllint --schema
> http://www.fdsn.org/xml/station/fdsn-station-1.0.xsd
> 'http://geofon.gfz-potsdam.de/fdsnws/station/1/query?net=GE&sta=STU&cha=BHZ&loc=--&starttime=2014-04-10T00:00:00&endtime=2014-04-10T00:10:00&level=channel'
> --noout
> http://geofon.gfz-potsdam.de/fdsnws/station/1/query?net=GE&sta=STU&cha=BHZ&loc=--&starttime=2014-04-10T00:00:00&endtime=2014-04-10T00:10:00&level=channel
> validates
> 
> 
> Best Regards,
> Benjamin Sick
> 
> -- 
> Dipl.-Ing. Benjamin Sick
> Institut für Geophysik
> Universität Stuttgart
> 
> Email: benjamin.sick at geophys.uni-stuttgart.de
> Website: http://www.geophys.uni-stuttgart.de/mitarbeiter/sick_benjamin.html
> Phone: +49 711 685-87422
> Fax: +49 711 685-87401
> 
> _______________________________________________
> webservices mailing list
> webservices at iris.washington.edu
> http://www.iris.washington.edu/mailman/listinfo/webservices




More information about the webservices mailing list