diff --git a/changelog.html b/changelog.html
index 7e7da28791422359b59c7aaae50abbc92c6c05f7..951daff7768e2a843b3043197b1a3f4133e3b00a 100644
--- a/changelog.html
+++ b/changelog.html
@@ -55,6 +55,9 @@ Upcoming changes
+ -
+ Build format change migrator in 1.597 did not work on some Windows systems.
+ (issue 26519)
-
Errors in some Maven builds since 1.598.
(issue 26601)
@@ -81,9 +84,6 @@ Upcoming changes
- -
- Build format change migrator in 1.597 did not work on some Windows systems.
- (issue 26519)
-
FutureImpl does not cancel its start future.
(issue 25514)
diff --git a/core/src/main/java/jenkins/model/RunIdMigrator.java b/core/src/main/java/jenkins/model/RunIdMigrator.java
index a5be92c830118928f4d3518325dc3b36f2746d96..4666a5fb8655f146814ab6cf9ac284ba23646a34 100644
--- a/core/src/main/java/jenkins/model/RunIdMigrator.java
+++ b/core/src/main/java/jenkins/model/RunIdMigrator.java
@@ -200,32 +200,22 @@ public final class RunIdMigrator {
while (it.hasNext()) {
File kid = it.next();
String name = kid.getName();
- boolean numeric = false;
try {
Integer.parseInt(name);
- numeric = true;
- } catch (NumberFormatException x) {}
+ } catch (NumberFormatException x) {
+ LOGGER.log(FINE, "ignoring nonnumeric entry {0}", name);
+ continue;
+ }
try {
- String link = Util.resolveSymlink(kid);
- 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);
- }
- }
+ if (Util.isSymlink(kid)) {
+ LOGGER.log(FINE, "deleting build number symlink {0} → {1}", new Object[] {name, Util.resolveSymlink(kid)});
+ } else if (kid.isDirectory()) {
+ LOGGER.log(FINE, "ignoring build directory {0}", name);
continue;
- }
- if (numeric) {
- LOGGER.log(FINE, "deleting build number symlink {0} → {1}", new Object[] {name, link});
- Util.deleteFile(kid);
} else {
- LOGGER.log(FINE, "skipping other symlink {0} → {1}", new Object[] {name, link});
+ LOGGER.log(WARNING, "need to delete anomalous file entry {0}", name);
}
+ Util.deleteFile(kid);
it.remove();
} catch (Exception x) {
LOGGER.log(WARNING, "failed to process " + kid, x);
diff --git a/core/src/test/java/jenkins/model/RunIdMigratorTest.java b/core/src/test/java/jenkins/model/RunIdMigratorTest.java
index ce5c6d89e6110878f856c4bee662f87e23cf47f0..fb9805db779d2ea24e2f7e53b1040cf222875e35 100644
--- a/core/src/test/java/jenkins/model/RunIdMigratorTest.java
+++ b/core/src/test/java/jenkins/model/RunIdMigratorTest.java
@@ -42,7 +42,6 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
-import org.jvnet.hudson.test.Issue;
public class RunIdMigratorTest {
@@ -129,18 +128,6 @@ public class RunIdMigratorTest {
assertEquals("{1=→2014-01-02_03-04-05, 2014-01-02_03-04-05={build.xml='\n\n ok\n 1\n ok\n'}}", summarize());
}
- @Issue("JENKINS-26519")
- @Test public void windowsQuasiLinks() throws Exception {
- write("2014-01-02_03-04-05/build.xml", "\n\n ok\n 99\n ok\n");
- write("99", "2014-01-02_03-04-05");
- write("lastFailedBuild", "-1");
- write("lastSuccessfulBuild", "99");
- assertEquals("{2014-01-02_03-04-05={build.xml='\n\n ok\n 99\n ok\n'}, 99='2014-01-02_03-04-05', lastFailedBuild='-1', lastSuccessfulBuild='99'}", summarize());
- assertTrue(migrator.migrate(dir, null));
- assertEquals("{99={build.xml='\n\n ok\n 2014-01-02_03-04-05\n 1388649845000\n ok\n'}, lastFailedBuild='-1', lastSuccessfulBuild='99', legacyIds='2014-01-02_03-04-05 99\n'}", summarize());
- assertEquals(99, migrator.findNumber("2014-01-02_03-04-05"));
- }
-
// TODO test sane recovery from various error conditions
private void write(String file, String text) throws Exception {