Skip to content

Commit

Permalink
[JENKINS-13599] Provided better implementation of
Browse files Browse the repository at this point in the history
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 committed Apr 25, 2012
1 parent 78e416c commit ea6de1e
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions src/main/java/hudson/plugins/doxygen/DoxygenDirectoryParser.java
Expand Up @@ -49,7 +49,6 @@ public DoxygenDirectoryParser(String publishType, String doxyfilePath, String do
} }


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

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


protected Boolean isDirectoryAbsolute(FilePath base, // See https://issues.jenkins-ci.org/browse/JENKINS-13599
final String finalComputedDoxygenDir) throws IOException, protected boolean isDirectoryAbsolute(String path) {
InterruptedException { File file = new File(path);
Boolean absolute = false; String absolutePath = file.getAbsolutePath();
absolute = base.act(new FilePath.FileCallable<Boolean>() { LOGGER.info(String.format("passed in path:%s, absolutePath:%s",
public Boolean invoke(File f, VirtualChannel channel) path, absolutePath));
throws IOException, InterruptedException { if(path.equals(file.getAbsolutePath())) {

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

protected Boolean isDirectoryAbsolute(FilePath base,
return parentFile.exists(); final String finalComputedDoxygenDir) throws IOException,
} InterruptedException {
}); Boolean absolute = false;
return absolute; 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 * Load the Doxyfile Doxygen file in memory
Expand Down

0 comments on commit ea6de1e

Please sign in to comment.