Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-17034] Fixed NPE during guessing of result file path.
  • Loading branch information
uhafner committed Mar 6, 2013
1 parent 79643e7 commit 5c5b08d
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/main/java/hudson/plugins/checkstyle/CheckStyleReporter.java
@@ -1,25 +1,28 @@
package hudson.plugins.checkstyle;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
import org.kohsuke.stapler.DataBoundConstructor;

import hudson.FilePath;
import hudson.maven.MavenAggregatedReport;
import hudson.maven.MavenBuildProxy;
import hudson.maven.MojoInfo;
import hudson.maven.MavenBuild;
import hudson.maven.MavenModule;

import hudson.plugins.analysis.core.FilesParser;
import hudson.plugins.analysis.core.HealthAwareReporter;
import hudson.plugins.analysis.core.ParserResult;
import hudson.plugins.analysis.util.PluginLogger;
import hudson.plugins.checkstyle.parser.CheckStyleParser;
import hudson.remoting.VirtualChannel;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
import org.kohsuke.stapler.DataBoundConstructor;
import hudson.remoting.VirtualChannel;

/**
* Publishes the results of the Checkstyle analysis (maven 2 project type).
Expand Down Expand Up @@ -125,11 +128,15 @@ public ParserResult perform(final MavenBuildProxy build, final MavenProject pom,

private FilePath getFileName(final MojoInfo mojo, final MavenProject pom) {
try {
return new FilePath((VirtualChannel)null, mojo.getConfigurationValue("outputFile", String.class));
String configurationValue = mojo.getConfigurationValue("outputFile", String.class);
if (StringUtils.isNotBlank(configurationValue)) {
return new FilePath((VirtualChannel)null, configurationValue);
}
}
catch (ComponentConfigurationException exception) {
return getTargetPath(pom).child(CHECKSTYLE_XML_FILE);
// ignore and use fall back value
}
return getTargetPath(pom).child(CHECKSTYLE_XML_FILE);
}

@Override
Expand Down

1 comment on commit 5c5b08d

@hitliuyang
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see by see

Please sign in to comment.