membrane / soa-model

Toolkit and Java API for WSDL, WADL and XML Schema.
http://www.membrane-soa.org/soa-model/
Apache License 2.0
94 stars 73 forks source link

Non-200 response throwing MissingPropertyException instead of ResourceDownloadException #257

Open brockmatt opened 7 years ago

brockmatt commented 7 years ago

It appears that any non-200 response will throw a MissingPropertyExceptioninstead of a ResourceDownloadExceptiondue to an invalid property reference. The issue can be found on line 121 of ExternalResolver.groovy:

  if(response.statusLine.statusCode != 200) {
    def rde = new ResourceDownloadException("could not get resource $url by HTTP")
    rde.status = status /* MissingPropertyException exception thrown here */
    rde.url = url
    method.releaseConnection()
    throw rde
  }

There is no property status, which causes it to throw the new exception and never set the status code correctly. This effectively means there's no way to catch non-200 responses.

This can be fixed very easily by changing the line to:

rde.status = response.statusLine.statusCode