Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Fix JENKINS-13569] Don't look for artifacts if there are none.

If "attach archived artifacts" is checked, but the "Archive the artifacts"
post-build option is not, attemping to look for artifacts results in
a NPE.
  • Loading branch information...
commit c712a3c4af6e444febb2b5a3c50f69e1abcf9339 1 parent 00f2e55
@jhansche authored
View
21 src/main/java/com/myyearbook/hudson/plugins/confluence/ConfluencePublisher.java
@@ -248,6 +248,13 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
boolean result = true;
ConfluenceSite site = getSite();
+
+ if (site == null) {
+ log(listener, "Not publishing because no Confluence Site could be found. " +
+ "Check your Confluence configuration in system settings.");
+ return true;
+ }
+
ConfluenceSession confluence = site.createSession();
Result buildResult = build.getResult();
@@ -399,13 +406,17 @@ private String performEdits(final AbstractBuild<?, ?> build, final BuildListener
*/
private List<FilePath> findArtifacts(File artifactsDir) {
ArrayList<FilePath> files = new ArrayList<FilePath>();
- for (File f : artifactsDir.listFiles()) {
- if (f.isDirectory()) {
- files.addAll(findArtifacts(f));
- } else if (f.isFile()) {
- files.add(new FilePath(f));
+
+ if (artifactsDir != null) {
+ for (File f : artifactsDir.listFiles()) {
+ if (f.isDirectory()) {
+ files.addAll(findArtifacts(f));
+ } else if (f.isFile()) {
+ files.add(new FilePath(f));
+ }
}
}
+
return files;
}
Please sign in to comment.
Something went wrong with that request. Please try again.