rabbitmq-java-client icon indicating copy to clipboard operation
rabbitmq-java-client copied to clipboard

Channel#abort discards exceptions which it declares as thrown

Open thiagomiranda3 opened this issue 6 years ago • 1 comments

On the code below that I got from master: /** Public API - {@inheritDoc} */ @Override public void abort(int closeCode, String closeMessage) throws IOException { try { close(closeCode, closeMessage, true, null, true); } catch (IOException _e) { /* ignored */ } catch (TimeoutException _e) { /* ignored */ } }

The method abort throw an IOException that I need to catch when calling this method. But this exception is silently discarded inside them and in the documentation is written that too. So I was suspicious that the documentation was not up to date and had to check the source to verify their validity. Wouldn't be possible to remove this throw? I am not sure with it is necessary in another classes that override this method.

thiagomiranda3 avatar Dec 18 '18 12:12 thiagomiranda3

This makes sense, considering the semantics mentioned in the API documentation and the consistency with Connection#abort. This is a breaking change though (code catching the IOException won't compile anymore), so it must go into 6.0.

acogoluegnes avatar Dec 19 '18 08:12 acogoluegnes