Skip to content

Commit

Permalink
[JENKINS-38978] Prevent FindBugs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
marcrohlfs committed Jan 4, 2018
1 parent 4e63757 commit c68feda
Showing 1 changed file with 5 additions and 11 deletions.
Expand Up @@ -85,7 +85,7 @@ public class MavenMetadataParameterDefinition extends MavenMetadataParameterDefi
private static final Pattern MATCH_ALL = Pattern.compile(".*");
private static final Charset UTF8 = Charset.forName("UTF-8");

private transient int maxVers = Integer.MIN_VALUE;
private transient Integer maxVers = null;
private transient Pattern versionFilterPattern = null;

private final String repoBaseUrl;
Expand Down Expand Up @@ -124,13 +124,12 @@ public MavenMetadataParameterDefinition(String name, String description, String
}

public int getMaxVers() {
if (this.maxVers == Integer.MIN_VALUE) {
int maxVers = Integer.MAX_VALUE;
if (this.maxVers == null) {
try {
maxVers = Integer.parseInt(maxVersions);
this.maxVers = Integer.parseInt(maxVersions);
} catch (NumberFormatException e) {
this.maxVers = Integer.MAX_VALUE;
}
this.maxVers = maxVers;
}
return this.maxVers;
}
Expand Down Expand Up @@ -309,12 +308,7 @@ private MavenMetadataVersions getArtifactMetadata() {
result.versioning.versions.add("<" + e.getClass().getName() + ": " + e.getMessage() + ">");
return result;
} finally {
try {
if (input != null)
input.close();
} catch (IOException e) {
// ignore
}
IOUtils.closeQuietly(input);
}
}

Expand Down

0 comments on commit c68feda

Please sign in to comment.