Skip to content

Commit

Permalink
avoid NPE in readFileFromWorkspace
Browse files Browse the repository at this point in the history
[FIXES JENKINS-43537]
  • Loading branch information
daspilker committed Apr 12, 2017
1 parent b5146c8 commit c543398
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/Home.md
Expand Up @@ -29,6 +29,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins

## Release Notes
* 1.61 (unreleased)
* Fixed a problem with `readFileFromWorkspace`
([JENKINS-43537](https://issues.jenkins-ci.org/browse/JENKINS-43537))
* 1.60 (April 10 2017)
* Enabled script approval with the
[Script Security Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Script+Security+Plugin), see
Expand Down
Expand Up @@ -263,14 +263,18 @@ public void queueJob(String path) throws NameNotProvidedException {

@Override
public InputStream streamFileInWorkspace(String relLocation) throws IOException, InterruptedException {
project.checkPermission(Item.WORKSPACE);
if (project != null) {
project.checkPermission(Item.WORKSPACE);
}
FilePath filePath = locateValidFileInWorkspace(workspace, relLocation);
return filePath.read();
}

@Override
public String readFileInWorkspace(String relLocation) throws IOException, InterruptedException {
project.checkPermission(Item.WORKSPACE);
if (project != null) {
project.checkPermission(Item.WORKSPACE);
}
FilePath filePath = locateValidFileInWorkspace(workspace, relLocation);
return filePath.readToString();
}
Expand Down

0 comments on commit c543398

Please sign in to comment.