Navigation Menu

Skip to content

Commit

Permalink
[JENKINS-26519] More diagnostics in case a numeric rename target alre…
Browse files Browse the repository at this point in the history
…ady exists.
  • Loading branch information
jglick committed Jan 28, 2015
1 parent 2b1ef0b commit 75c8c31
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions core/src/main/java/jenkins/model/RunIdMigrator.java
Expand Up @@ -200,18 +200,30 @@ private void doMigrate(File dir) {
while (it.hasNext()) {
File kid = it.next();
String name = kid.getName();
boolean numeric = false;
try {
Integer.parseInt(name);
numeric = true;
} catch (NumberFormatException x) {}
try {
String link = Util.resolveSymlink(kid);
if (link == null && name.matches("\\d+") && kid.isFile()) { // legacy Windows format
if (link == null && numeric && kid.isFile()) { // legacy Windows format
link = FileUtils.readFileToString(kid);
} else if (link == null) {
if (numeric) {
if (kid.isDirectory()) {
LOGGER.log(FINE, "skipping deletion of directory {0}", name);
} else {
LOGGER.log(WARNING, "need to delete non-symlink numeric directory entry {0}", name);
Util.deleteFile(kid);
}
}
continue;
}
try {
Integer.parseInt(name);
if (numeric) {
LOGGER.log(FINE, "deleting build number symlink {0} → {1}", new Object[] {name, link});
Util.deleteFile(kid);
} catch (NumberFormatException x) {
} else {
LOGGER.log(FINE, "skipping other symlink {0} → {1}", new Object[] {name, link});
}
it.remove();
Expand Down

0 comments on commit 75c8c31

Please sign in to comment.