Skip to content
Permalink
Browse files

[JENKINS-24380] Updated to handle proposed new build directory format.

  • Loading branch information
jglick committed Dec 15, 2014
1 parent dd8b916 commit ffb47e151f50cf1ce0618e339b8e4a592d96845d
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java
@@ -612,13 +612,24 @@ public synchronized int n() {
int builds = 0;
// protected access: File buildDir = j.getBuildDir();
File buildDir = Jenkins.getInstance().getBuildDirFor(j);
boolean newFormat = new File(buildDir, "legacyIds").isFile(); // JENKINS-24380
File[] buildDirs = buildDir.listFiles();
if (buildDirs != null) {
for (File d : buildDirs) {
if (mayBeDate(d.getName())) {
String name = d.getName();
if (newFormat) {
try {
Integer.parseInt(name);
if (d.isDirectory()) {
builds++;
}
} catch (NumberFormatException x) {
// something else
}
} else /* legacy format */if (mayBeDate(name)) {
// check for real
try {
BUILD_FORMAT.parse(d.getName());
BUILD_FORMAT.parse(name);
if (d.isDirectory()) {
builds++;
}

0 comments on commit ffb47e1

Please sign in to comment.
You can’t perform that action at this time.