Skip to content
Permalink
Browse files

[JENKINS-13599] Provided better implementation of

DoxygenDirectoryParser#isDirectoryAbsolute(). The previous implementation would
incorrectly think that doc was absolute because java.io.File found /home/y/doc
  • Loading branch information
Albert So
Albert So committed Apr 25, 2012
1 parent 78e416c commit ea6de1eef23d6d57de5f1e3be469771e8398472a
Showing with 28 additions and 21 deletions.
  1. +28 −21 src/main/java/hudson/plugins/doxygen/DoxygenDirectoryParser.java
@@ -49,7 +49,6 @@ public DoxygenDirectoryParser(String publishType, String doxyfilePath, String do
}

public FilePath invoke(java.io.File workspace, VirtualChannel channel) throws IOException {

try {
return (DoxygenArchiverDescriptor.DOXYGEN_HTMLDIRECTORY_PUBLISHTYPE).equals(publishType)
? retrieveDoxygenDirectoryFromHudsonConfiguration(doxygenHtmlDirectory, new FilePath(workspace))
@@ -164,26 +163,34 @@ public Boolean invoke(File f, VirtualChannel channel) throws IOException, Interr
return result;
}

protected Boolean isDirectoryAbsolute(FilePath base,
final String finalComputedDoxygenDir) throws IOException,
InterruptedException {
Boolean absolute = false;
absolute = base.act(new FilePath.FileCallable<Boolean>() {
public Boolean invoke(File f, VirtualChannel channel)
throws IOException, InterruptedException {

File parentFile = new File(finalComputedDoxygenDir).getParentFile();
if (parentFile == null) {
// A computed directory with no parent will return null.
// Guard against a NullPointerException
return false;
}

return parentFile.exists();
}
});
return absolute;
}
// See https://issues.jenkins-ci.org/browse/JENKINS-13599
protected boolean isDirectoryAbsolute(String path) {
File file = new File(path);
String absolutePath = file.getAbsolutePath();
LOGGER.info(String.format("passed in path:%s, absolutePath:%s",
path, absolutePath));
if(path.equals(file.getAbsolutePath())) {
return true;
}
else {
return false;
}
}

protected Boolean isDirectoryAbsolute(FilePath base,
final String finalComputedDoxygenDir) throws IOException,
InterruptedException {
Boolean absolute = false;
absolute = base.act(new FilePath.FileCallable<Boolean>() {
public Boolean invoke(File f, VirtualChannel channel)
throws IOException, InterruptedException {

// See https://issues.jenkins-ci.org/browse/JENKINS-13599
return isDirectoryAbsolute(finalComputedDoxygenDir);
}
});
return absolute;
}

/**
* Load the Doxyfile Doxygen file in memory

0 comments on commit ea6de1e

Please sign in to comment.
You can’t perform that action at this time.