Skip to content

Conversation

@ramabit
Copy link
Contributor

@ramabit ramabit commented Oct 7, 2016

Documentation: http://xmpp.org/extensions/inbox/isr.html

WARNING: This implementation wasn't tested against a server yet.
However, it has many unit tests checking nonzas parsers and validations.

I send this PR in order to receive feedback and refine it.
fyi @Flowdalic

hash.append(hex);
}
digest = hash.toString();
} catch (UnsupportedEncodingException e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never swallow Exceptions! Use a try/multi-catch and throw a unchecked exception, e.g. InvalidStateException in this case. In cases where the exception can be ignored, log it at least with a FINE/FINER/FINEST level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Flowdalic fixed

} catch (InvalidKeyException e) {
} catch (NoSuchAlgorithmException e) {
} catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) {
throw new IllegalStateException("HMAC digest couldn't be done correctly.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the catched Exception to the ISE, so that it doesn't get lost:

throw new IllegalStateException("HMAC digest couldn't be done correctly.", e);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Flowdalic done

@ramabit ramabit closed this Nov 1, 2016
@ramabit ramabit reopened this Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants