Skip to content

Commit

Permalink
devonfw#1065: fix NPE on upgrade (maven repo access) (devonfw#1072)
Browse files Browse the repository at this point in the history
Co-authored-by: jan-vcapgemini <[email protected]>
  • Loading branch information
2 people authored and julia-cap committed Feb 28, 2025
1 parent 8f3c98e commit 54b2a82
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions cli/src/main/java/com/devonfw/tools/ide/context/IdeContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -609,21 +609,24 @@ default String getMavenArgs() {
*/
default Path getMavenConfigurationFolder() {

if (getIdeHome() != null) {
Path confPath = getConfPath();
Path m2Folder = confPath.resolve(Mvn.MVN_CONFIG_FOLDER);
if (!Files.isDirectory(m2Folder)) {
Path confPath = getConfPath();
Path mvnConfFolder = null;
if (confPath != null) {
mvnConfFolder = confPath.resolve(Mvn.MVN_CONFIG_FOLDER);
if (!Files.isDirectory(mvnConfFolder)) {
Path m2LegacyFolder = confPath.resolve(Mvn.MVN_CONFIG_LEGACY_FOLDER);
if (Files.isDirectory(m2LegacyFolder)) {
m2Folder = m2LegacyFolder;
mvnConfFolder = m2LegacyFolder;
} else {
// fallback to USER_HOME/.m2 folder
m2Folder = getUserHome().resolve(Mvn.MVN_CONFIG_LEGACY_FOLDER);
mvnConfFolder = null; // see fallback below
}
}
return m2Folder;
}
return null;
if (mvnConfFolder == null) {
// fallback to USER_HOME/.m2 folder
mvnConfFolder = getUserHome().resolve(Mvn.MVN_CONFIG_LEGACY_FOLDER);
}
return mvnConfFolder;
}

/**
Expand Down

0 comments on commit 54b2a82

Please sign in to comment.