You are currently browsing the Philipp Meier's weblog blog archives for December, 2004

podcast


mail
information

Battling eBay with java – java.lang.IllegalStateException

During my explorations of the [eBay Java SDK](http://developer.ebay.com) which uses [Apache Axis](http://xml.apache.org/axis) to access [eBay](http://www.ebay.com)’s [SOAP](http://www.w3.org/TR/soap/) interface I stumbled over the following fine piece of bad bad bad code:

public static BuyerPaymentMethodCodeType fromString(String value)
throws java.lang.IllegalStateException {
try {
return fromValue(new org.apache.axis.types.Token(value));
} catch (Exception e) {
throw new java.lang.IllegalStateException();
}
}

Why is it bad? Because the IllegalStateException which is thrown does not contain any pointer to the cause of the exception. In my case eBay was returning a PaymentTypeCode which is not valid according to the published wsdl. It took my 1 day and a download of the axis source tarball to catch this one. I want to note that the code mentioned has been generated by axis’ wsdl2java from the wsdl published by ebay. I will have to dig a little deeper.

support
careers

Bear
support