Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[JENKINS-8436] Successful build ends with NPE

Submitted by Marco Rothe
  • Loading branch information...
commit cc0113dafdd1e1c0048d9230eb91ab2b15fe0588 1 parent 888b9d3
@olamy olamy authored
Showing with 16 additions and 6 deletions.
  1. +16 −6 maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
View
22 maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
@@ -333,14 +333,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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.