Suppressing exceptions

so I've a method which possibly can throw 6 exceptions in signature, but some of them can't be thrown unless u messed up with code and changed constants Is it good idea to just add try/catch and ignore them? method sign:
public String encrypt(String text) throws
NoSuchPaddingException, NoSuchAlgorithmException,
InvalidAlgorithmParameterException, InvalidKeyException,
IllegalBlockSizeException, BadPaddingException {
public String encrypt(String text) throws
NoSuchPaddingException, NoSuchAlgorithmException,
InvalidAlgorithmParameterException, InvalidKeyException,
IllegalBlockSizeException, BadPaddingException {
4 Replies
JavaBot
JavaBot7mo ago
This post has been reserved for your question.
Hey @XION! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st7mo ago
If these should never happen and it happening would be a programing error, you might want to catch and re-throw/wrap them as unchecked exceptions or you might generally want to wrap them in some exception specific to your logic
XION
XIONOP7mo ago
ty
JavaBot
JavaBot7mo ago
Post Closed
This post has been closed by <@564846439222738964>.

Did you find this page helpful?