Skip to content

Return when PercentageEnricher cannot compute result#249

Merged
asfgit merged 1 commit intoapache:masterfrom
grkvlt:percentage-enricher-return-not-npe
Jul 12, 2016
Merged

Return when PercentageEnricher cannot compute result#249
asfgit merged 1 commit intoapache:masterfrom
grkvlt:percentage-enricher-return-not-npe

Conversation

@grkvlt
Copy link
Copy Markdown
Member

@grkvlt grkvlt commented Jul 12, 2016

Does not pollute INFO log with exception stack traces. Also replaces check for zero with a DoubleMath.fuzzyCompare() call using an epsilon of 1x10^-12 to allow for floating point inaccuracies.

@grkvlt grkvlt force-pushed the percentage-enricher-return-not-npe branch from cf5f6c5 to 8566791 Compare July 12, 2016 06:06

if (currentDouble < 0 || totalDouble < 0) {
LOG.debug("Can't calculate Enricher ({}) value for entity ({}) as Current ({}) or total ({}) value from producer ({}) is negative, returning", new Object[]{JavaClassNames.simpleClassName(this), entity, currentDouble, totalDouble, producer});
if (currentDouble < 0d || totalDouble < 0d) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure why we disallow negative percentages, but that was already the case. So your PR looks good.

@asfgit asfgit merged commit 8566791 into apache:master Jul 12, 2016
asfgit pushed a commit that referenced this pull request Jul 12, 2016
@grkvlt grkvlt deleted the percentage-enricher-return-not-npe branch July 13, 2016 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants