Skip to content

Commit

Permalink
Merge pull request #10 from ydubreuil/fix-JENKINS-30224
Browse files Browse the repository at this point in the history
[JENKINS-30224] use real listener to prevent NPE
  • Loading branch information
Bagira80 committed Sep 12, 2015
2 parents 68c526d + bcdd477 commit 2bdfc0d
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -196,12 +196,12 @@ public String getEnvironmentVariableName() {
public String getEnvironmentPrefixVariable() {
return this.environmentPrefixVariable;
}
private Run getPreviousBuildWithVersionNumber(AbstractBuild build) {
private Run getPreviousBuildWithVersionNumber(AbstractBuild build, BuildListener listener) {
String envPrefix;

if (this.environmentPrefixVariable != null) {
try {
EnvVars env = build.getEnvironment(null);
EnvVars env = build.getEnvironment(listener);

envPrefix = env.get(this.environmentPrefixVariable);
} catch (IOException e) {
Expand Down Expand Up @@ -238,8 +238,9 @@ private Run getPreviousBuildWithVersionNumber(AbstractBuild build) {
}

@SuppressWarnings("unchecked")
private VersionNumberBuildInfo incBuild(AbstractBuild build, Map<String, String> enVars, PrintStream log) throws IOException {
Run prevBuild = getPreviousBuildWithVersionNumber(build);
private VersionNumberBuildInfo incBuild(AbstractBuild build, BuildListener listener) throws IOException, InterruptedException {
Map<String, String> enVars = build.getEnvironment(listener);
Run prevBuild = getPreviousBuildWithVersionNumber(build, listener);
int buildsToday = 1;
int buildsThisMonth = 1;
int buildsThisYear = 1;
Expand Down Expand Up @@ -494,7 +495,7 @@ private static String sizeTo(String s, int length) {
public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener) {
String formattedVersionNumber = "";
try {
VersionNumberBuildInfo info = incBuild(build, build.getEnvironment(listener), listener.getLogger());
VersionNumberBuildInfo info = incBuild(build, listener);
formattedVersionNumber = formatVersionNumber(this.versionNumberString,
this.projectStartDate,
info,
Expand Down

0 comments on commit 2bdfc0d

Please sign in to comment.