Skip to content

Commit

Permalink
[JENKINS-8436] Successful build ends with NPE
Browse files Browse the repository at this point in the history
Submitted by Marco Rothe
  • Loading branch information
olamy authored and kohsuke committed Apr 7, 2011
1 parent 37f9f72 commit c0643de
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
Expand Up @@ -324,14 +324,24 @@ private long estimateModuleSetBuildDurationOverhead(int numberOfBuilds) {
}

private static String normalizePath(String relPath) {
// JENKINS-8525 FilenameUtils.normalize for ../foo returns null
if (StringUtils.isEmpty(relPath) || StringUtils.startsWith( relPath, "../" )) {
LOGGER.config("No need to normalize " + (StringUtils.isEmpty(relPath) ? "an empty path" : relPath));
relPath = StringUtils.trimToEmpty( relPath );
if (StringUtils.isEmpty( relPath )) {
LOGGER.config("No need to normalize an empty path.");
} else {
String tmp = FilenameUtils.normalize( relPath );
LOGGER.config("Normalized path " + relPath + " to "+tmp);
relPath = tmp;
if(FilenameUtils.indexOfLastSeparator( relPath ) == -1) {
LOGGER.config("No need to normalize "+relPath);
} else {
String tmp = FilenameUtils.normalize( relPath );
if(tmp == null) {
LOGGER.config("Path " + relPath + " can not be normalized (parent dir is unknown). Keeping as is.");
} else {
LOGGER.config("Normalized path " + relPath + " to "+tmp);
relPath = tmp;
}
relPath = FilenameUtils.separatorsToUnix( relPath );
}
}
LOGGER.fine("Returning path " + relPath);
return relPath;
}

Expand Down

0 comments on commit c0643de

Please sign in to comment.