mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
[JENKINS-8436] Successful build ends with NPE
Submitted by Marco Rothe
This commit is contained in:
1 parent
888b9d3683
commit
cc0113dafd
1 file changed
+16
-6
@@ -333,14 +333,24 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user