-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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-8178] Fall back to system properties for missing profile activation context properties #1603
Conversation
1029de6
to
34d63f0
Compare
A call to context.getSystemProperties() may yield empty an empty map, or one missing the desired key, which makes a subsequent call of toLowerCase fail with a NullPointerException. Fall-back to using System.getProperty (with an empty default, in case that one fails too).
34d63f0
to
b3a0523
Compare
We should try to find root cause ... why properties is not available in contexts |
@slawekjaranowski DefaultProfileActivationContext.setSystemProperties allows empty/null system properties (the default value if setSystemProperties isn't called is an empty map, too). Moreover, I don't think we can make any assumptions on "os.name", etc., to be available. As to where this from: I've added an exception to
|
? You are building a site here? As we have related issue https://issues.apache.org/jira/browse/DOXIASITETOOLS-343 that may be related... |
Bug description here https://issues.apache.org/jira/browse/MNG-8135 |
The assumption is not |
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.
The assumption is not context.getSystemProperties() returns... system properties. So imho, the PR is wrong and it means the caller does not set the system properties correctly. In Maven itself, the only place is in DefaultModelBuilder, where properties are set correctly afaik. So the bug is that the system properties are not correctly set on the request:
https://github.com/apache/maven-project-info-reports-plugin/blob/master/src/main/java/org/apache/maven/report/projectinfo/ModulesReport.java#L160-L162
This is a problem in maven-project-info-reports-plugin
and should be fixed there imho.
@gnodet I see. Can you please coordinate this? I'm just a frustrated user. Thanks a lot! |
We could mitigate the issue by supporting null values though instead of calling |
@gnodet By just "handling" null values (e.g., converting to ""), we wouldn't get the correct "active" state for profiles based on the OS. I really don't see what we'd lose by falling back to |
@gnodet Moreover, this is a regression from 3.9.6. Who knows, maybe more plugins are affected by this. |
Ah, I see now.
It should have the desired behaviour without introducing new calls. |
Am I stupid or why are these props empty? |
|
Nice catch, let me please review all reporting plugins before we merge this. I do remember some other stuff. |
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.
Fine with me, will continue on the fix in MPIR.
A call to context.getSystemProperties() may yield empty an empty map, or one missing the desired key, which makes a subsequent call of toLowerCase fail with a NullPointerException.
Fall-back to using System.getProperty (with an empty default, in case that one fails too).
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MNG-XXX] SUMMARY
,where you replace
MNG-XXX
andSUMMARY
with the appropriate JIRA issue.[MNG-XXX] SUMMARY
.Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
mvn clean verify
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.