You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Alexei Krainiouk (JIRA)" <ji...@apache.org> on 2019/04/26 04:10:00 UTC
[jira] [Updated] (SLING-8374) Missing out exceptions in catch
clause in DistributionSubscriber class
[ https://issues.apache.org/jira/browse/SLING-8374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexei Krainiouk updated SLING-8374:
------------------------------------
Description:
There are two cases when catch clause is not catching necessary exceptions.
# in [DistributionSubscriber.timedSendStoredStatus|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L663] method. Apparently the intent is to catch an exception thrown by sendStatusMessage() method which in turn triggered by [sender.send()|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L690] invocation. However sender.send() method throws MessagingException which subclasses RuntimeError rather then Exception. As a result the exception is never caught.
# in [DistributionSubscriber.importPackage|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L690] method. catch (Exception e) should be replaced with catch (Throwable e) in order to count all possible errors in failedPackageImports metric.
This pull request provide fixes for above issues: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/3
was:
There are two cases when catch clause is not catching necessary exceptions.
# in [DistributionSubscriber.timedSendStoredStatus|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L663] method. Apparently the intent is to catch an exception thrown by sendStatusMessage() method which in turn triggered by [sender.send()|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L690] invocation. However sender.send() method throws MessagingException which subclasses RuntimeError rather then Exception. As a result the exception is never caught.
# in [DistributionSubscriber.importPackage|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L690] method. catch (Exception e) should be replaced with catch (Throwable e) in order to count all possible errors in failedPackageImports metric.
> Missing out exceptions in catch clause in DistributionSubscriber class
> ----------------------------------------------------------------------
>
> Key: SLING-8374
> URL: https://issues.apache.org/jira/browse/SLING-8374
> Project: Sling
> Issue Type: Bug
> Components: Content Distribution
> Affects Versions: Content Distribution Journal Core 0.1.0
> Reporter: Alexei Krainiouk
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> There are two cases when catch clause is not catching necessary exceptions.
> # in [DistributionSubscriber.timedSendStoredStatus|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L663] method. Apparently the intent is to catch an exception thrown by sendStatusMessage() method which in turn triggered by [sender.send()|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L690] invocation. However sender.send() method throws MessagingException which subclasses RuntimeError rather then Exception. As a result the exception is never caught.
> # in [DistributionSubscriber.importPackage|https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java#L690] method. catch (Exception e) should be replaced with catch (Throwable e) in order to count all possible errors in failedPackageImports metric.
> This pull request provide fixes for above issues: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/3
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)