Skip to content
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

[MNG-7738] don't dump raw stack traces to System.err #1064

Merged
merged 1 commit into from
Mar 22, 2023
Merged

Conversation

elharo
Copy link
Contributor

@elharo elharo commented Mar 17, 2023

No description provided.

@elharo elharo marked this pull request as ready for review March 19, 2023 12:25
@elharo elharo requested a review from michael-o March 19, 2023 12:25
@@ -73,8 +73,6 @@ public boolean matches(String requirement) {
return range.getRecommendedVersion().compareTo(version) == 0;
}
} catch (InvalidVersionSpecificationException ex) {
// TODO error reporting
ex.printStackTrace();
return false;
Copy link
Member

Choose a reason for hiding this comment

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

If this information is required, it should be ad debug log level

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish these classes were documented better, and I wish this one and several others were non-public. That said, it does seem it's used in only one other place where we do:

         if (!matcher.matches(requirement.getValue())) {
                getLog().debug("Toolchain " + this + " doesn't match required property: " + key);
                return false;
            }

That is, a false result already logs at debug level.

@@ -229,7 +229,7 @@ public ArtifactResolutionResult resolve(ArtifactResolutionRequest request) {
.map(Dependency::new)
.collect(Collectors.toList());
} catch (IOException e) {
e.printStackTrace();
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor Author

@elharo elharo Mar 22, 2023

Choose a reason for hiding this comment

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

Given that this is test code, debug logging seems too weak. If this is a problem worth paying attention to, or that might explain why a test has failed or flaked, then bubble the IOException to immediately fail the test with the root cause rather than waiting for it to fail down the line.

On the other hand, if the test shouldn't and doesn't fail when this exception is thrown, then no debug log is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On further investigation, this immensely over-engineered class is used in exactly one test method testCacheKey which doesn't even enter this method when it runs.

@elharo elharo merged commit cadeab5 into master Mar 22, 2023
@elharo elharo deleted the MNG-7738 branch March 22, 2023 12:44
This pull request was closed.
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