question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bad error reporting

See original GitHub issue

Describe the bug Due to https://github.com/gradle/gradle/issues/11795, there are problems with the used library versions, as much older versions needed by stuff in buildSrc win in the class path and then there are missing method exceptions.

This of course is not your fault and not what I report here. But the output in this case is sometimes super unhelpful, which is what I do report here.

A good example is a too old commons-io (1.3.1) that causes the build to fail with

Execution failed for task ':dependencyCheckAnalyze'.
> org.owasp.dependencycheck.analyzer.Analyzer: Provider org.owasp.dependencycheck.analyzer.ArchiveAnalyzer could not be instantiated`

and if run with -s reveals the Caused by: java.lang.NoSuchMethodError: org.apache.commons.io.filefilter.SuffixFileFilter.<init>(Ljava/util/List;Lorg/apache/commons/io/IOCase;)V cause.

A bad example is a too old guava that causes the build to fail with

Execution failed for task ':dependencyCheckAnalyze'.
> Analysis failed.

and if run with -s only says

Caused by: org.owasp.dependencycheck.exception.ExceptionCollection: One or more exceptions occurred during analysis:
        Unexpected Exception

which is pretty meaningless. After setting a breakpoint and assembling the stacktrace in Engine#analyzeDependencies I finally got the cause which is Caused by: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V.

Version of dependency-check used The problem occurs using version 5.2.4 of the gradle plugin

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Vampirecommented, Jan 10, 2020

I’m not complaining about Gradle only showing the top-most message unless you use -s, that is normal and ok. I’m complaining about the stacktrace that you produce being totally unhelpful. This is not even dependency-check-gradle related, but dependency-check-parent related.

I’d say in ExceptionCollection which just assembles the messages of the top-most exceptions it got and nowhere the causes and stacktraces. The exception that came was with message Unexpected Exception and had as cause the NoSuchMethodError with the relevant information. But in the output, you only get the stacktrace of the ExceptionCollection and the top-most messages of the contained exceptions which does not help in any way to find the problem.

1reaction
danberindeicommented, Feb 2, 2021

@jeremylong since this issue is closed, is there another issue for reworking the overall exception handling?

@aikebah you say

Revisiting the addSuppressed documentation makes me reconsider… API contract of addSuppressed is for a different purpose - being able to swallow exceptions that happen after some initial exception that you intend to (re)throw at the end of error handling code.

But the addSuppressed() javadoc explicitly states that reporting multiple sibling exceptions as a single exception is a valid use case:

Note that programmer written code is also able to take advantage of calling this method in situations where there are multiple sibling exceptions and only one can be propagated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How bad error messages are harming your users - UX Collective
Be explicit and indicate something has gone wrong · Include messages on same screen as where the error occurred · Include the product...
Read more >
Bad Error Messages - InstructionalDesign.org
Bad Error Messages · Clearly indicate that something has gone wrong · Be in a human-readable language · Be polite and not blame...
Read more >
Error Messages: Examples, Best Practices & Common Mistakes
4 common mistakes with error messages · 1. Ambiguity · 2. Condescending language/blaming the user · 3. Poor placement of error messages ·...
Read more >
Bad error messages - SlideShare
Error messages written in a negative or even neutral tone can sound accusatory, suggesting that the visitor has misread instructions, filled out ...
Read more >
Error Handling Flaws - Information and How to Fix - Veracode
Improper error handling flaws occur when an error message that's displayed to an end user provides clues about how an application or website...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found