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 {

try {
return (DoxygenArchiverDescriptor.DOXYGEN_HTMLDIRECTORY_PUBLISHTYPE).equals(publishType)
? 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;
}

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
Expand Down

0 comments on commit ea6de1e

Please sign in to comment.