Skip to content
Permalink
Browse files

[JENKINS-26519] More diagnostics in case a numeric rename target alre…

…ady exists.

(cherry picked from commit 75c8c31)
  • Loading branch information
jglick committed Jan 30, 2015
1 parent 4a75e05 commit 22dc8add0e106d100a73c16cb628f1c5d1f94538
Showing with 16 additions and 4 deletions.
  1. +16 −4 core/src/main/java/jenkins/model/RunIdMigrator.java
@@ -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();

0 comments on commit 22dc8ad

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