Skip to content
Permalink
Browse files
[JENKINS-47909] Handle false hex escapes.
  • Loading branch information
jglick committed Nov 9, 2017
1 parent 397b4fa commit b6751222ba176b1aba396ea7dfffb977566b0d7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
@@ -303,7 +303,11 @@ public String idFromFilename(@Nonnull String filename) {
} else {
break;
}
buf.append(Character.valueOf((char)Integer.parseInt(hex.toString(), 16)));
try {
buf.append(Character.valueOf((char)Integer.parseInt(hex.toString(), 16)));
} catch (NumberFormatException x) {
buf.append('$').append(hex);
}
}
}
return buf.toString();
@@ -509,7 +513,11 @@ public String idFromFilename(@Nonnull String filename) {
} else {
break;
}
buf.append(Character.valueOf((char)Integer.parseInt(hex.toString(), 16)));
try {
buf.append(Character.valueOf((char)Integer.parseInt(hex.toString(), 16)));
} catch (NumberFormatException x) {
buf.append('$').append(hex);
}
}
}
return buf.toString();
@@ -29,6 +29,7 @@ public void caseInsensitive() {
assertCaseInsensitiveRoundTrip("NUL", "$006eul");
assertEquals("foo", idStrategy.idFromFilename("~foo"));
assertEquals("0123 _-@a", idStrategy.idFromFilename("0123 _-@~a"));
assertEquals("big$money", idStrategy.idFromFilename("big$money"));
}

@Test

0 comments on commit b675122

Please sign in to comment.