[ 
https://issues.apache.org/jira/browse/MNG-8178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17864298#comment-17864298
 ] 

ASF GitHub Bot commented on MNG-8178:
-------------------------------------

kohlschuetter opened a new pull request, #1603:
URL: https://github.com/apache/maven/pull/1603

   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:
   
    - [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/MNG) filed
          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.
    - [ ] Each commit in the pull request should have a meaningful subject line 
and body.
    - [ ] Format the pull request title like `[MNG-XXX] SUMMARY`,
          where you replace `MNG-XXX` and `SUMMARY` with the appropriate JIRA 
issue.
    - [ ] Also format the first line of the commit message like `[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.
    - [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more 
thorough check will
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.pdf) 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](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [X] I hereby declare this contribution to be licenced under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   




> Profile activation based on OS properties is broken for "mvn site"
> ------------------------------------------------------------------
>
>                 Key: MNG-8178
>                 URL: https://issues.apache.org/jira/browse/MNG-8178
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.9.7, 3.9.8
>            Reporter: Christian Kohlschütter
>            Priority: Blocker
>
> MNG-5726 introduced a breaking change that makes "mvn site" fail when 
> profiles based on OS activation are used.
> From commit f860a8693d38292c8ce9ee3b6a883559e7a94796 
> maven-model-builder/src/main/java/org/apache/mavqen/model/profile/activation/OperatingSystemProfileActivator.java:
>  
> {code:java}
> String actualOsName = 
> context.getSystemProperties().get("os.name").toLowerCase(Locale.ENGLISH);
> String actualOsArch = 
> context.getSystemProperties().get("os.arch").toLowerCase(Locale.ENGLISH);
> String actualOsVersion = 
> context.getSystemProperties().get("os.version").toLowerCase(Locale.ENGLISH);{code}
> context.getSystemProperties() may be empty (or not contain any of these three 
> keys), which makes toLowerCase(Locale) fail with a NullPointerException.
> Steps to reproduce:
>  
> {code:java}
> git clone https://github.com/kohlschutter/junixsocket.git
> git checkout 65602a9054eb232635678e1aa2f682969aaa059f
> ./scripts/build-site  
> {code}
> Output:
> {code:java}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-site-plugin:4.0.0-M11:site (default-site) on 
> project junixsocket: Failed to render reports: Error generating 
> maven-project-info-reports-plugin:3.6.1:modules report: Unable to read local 
> module POM: Some problems were encountered while processing the POMs:
> [ERROR] [ERROR] Failed to determine activation for profile 
> arch-x86_64-MacOSX: Cannot invoke "String.toLowerCase(java.util.Locale)" 
> because the return value of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 243, column 18
> [ERROR] [ERROR] Failed to determine activation for profile 
> arch-aarch64-MacOSX: Cannot invoke "String.toLowerCase(java.util.Locale)" 
> because the return value of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 261, column 18
> [ERROR] [ERROR] Failed to determine activation for profile arch-amd64-Linux: 
> Cannot invoke "String.toLowerCase(java.util.Locale)" because the return value 
> of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 280, column 18
> [ERROR] [ERROR] Failed to determine activation for profile 
> arch-aarch64-Linux: Cannot invoke "String.toLowerCase(java.util.Locale)" 
> because the return value of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 299, column 18
> [ERROR] [ERROR] Failed to determine activation for profile arch-amd64-NetBSD: 
> Cannot invoke "String.toLowerCase(java.util.Locale)" because the return value 
> of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 318, column 18
> [ERROR] [ERROR] Failed to determine activation for profile 
> arch-amd64-OpenBSD: Cannot invoke "String.toLowerCase(java.util.Locale)" 
> because the return value of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 337, column 18: 6 
> problems were encountered while building the effective model for 
> com.kohlschutter.junixsocket:junixsocket-native:2.10.1-SNAPSHOT
> [ERROR] [ERROR] Failed to determine activation for profile 
> arch-x86_64-MacOSX: Cannot invoke "String.toLowerCase(java.util.Locale)" 
> because the return value of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 243, column 18
> [ERROR] [ERROR] Failed to determine activation for profile 
> arch-aarch64-MacOSX: Cannot invoke "String.toLowerCase(java.util.Locale)" 
> because the return value of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 261, column 18
> [ERROR] [ERROR] Failed to determine activation for profile arch-amd64-Linux: 
> Cannot invoke "String.toLowerCase(java.util.Locale)" because the return value 
> of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 280, column 18
> [ERROR] [ERROR] Failed to determine activation for profile 
> arch-aarch64-Linux: Cannot invoke "String.toLowerCase(java.util.Locale)" 
> because the return value of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 299, column 18
> [ERROR] [ERROR] Failed to determine activation for profile arch-amd64-NetBSD: 
> Cannot invoke "String.toLowerCase(java.util.Locale)" because the return value 
> of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 318, column 18
> [ERROR] [ERROR] Failed to determine activation for profile 
> arch-amd64-OpenBSD: Cannot invoke "String.toLowerCase(java.util.Locale)" 
> because the return value of "java.util.Map.get(Object)" is null @ 
> com.kohlschutter.junixsocket:junixsocket:2.10.1-SNAPSHOT, 
> /Users/ck/Entwicklung/workspace/junixsocket/pom.xml, line 337, column 18
> [ERROR] -> [Help 1]
> [ERROR] 
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR] 
> [ERROR] For more information about the errors and possible solutions, please 
> read the following articles:
> [ERROR] [Help 1] 
> http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException{code}
> Suggested fix:
> Fall back to using Os.OS_NAME, Os.OS_ARCH, Os.OS_VERSION if the system 
> properties provided in the context is empty.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to