-
-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tls] Rethrow 'IOException' instead of swallowing it #3078
[tls] Rethrow 'IOException' instead of swallowing it #3078
Conversation
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
*/ | ||
public PEMTrustManager(String pemCert) throws CertificateException { | ||
if (!pemCert.isBlank() && pemCert.startsWith(BEGIN_CERT)) { | ||
try (InputStream certInputStream = new ByteArrayInputStream(pemCert.getBytes(StandardCharsets.UTF_8))) { | ||
trustedCert = (X509Certificate) CertificateFactory.getInstance("X.509") | ||
.generateCertificate(certInputStream); | ||
} catch (IOException e) { | ||
throw new CertificateException(e); | ||
LoggerFactory.getLogger(PEMTrustManager.class).debug("An IOException occurred: {}", e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the logger not an instance field? Otherwise LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Rethrow IOException instead of swollowing it Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> GitOrigin-RevId: f33492d
IOException
instead of swallowing itIn case of unreachable servers there is an
IOException
leading to an error message in the log file. This case can be handled even better when rethrowing the thrown exception which allows the calling instance to react to server side errors.https://community.openhab.org/t/vizio-tv-binding/138367/12
Signed-off-by: Christoph Weitkamp github@christophweitkamp.de