Skip to content

Commit

Permalink
[JENKINS-41124] Fix the one failing test (I hope)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenc committed Jan 19, 2017
1 parent 089eac1 commit c9730b1
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -222,8 +222,15 @@ public static String encode(String s) {
}

public static String mangle(String s) {
String hash = Util.getDigestOf(s);
String base = Normalizer.normalize(s, Normalizer.Form.NFD).toLowerCase(Locale.ENGLISH);
// NOTE: some file systems can use a different normalization strategy so we break from the ideal
// and force normalization to a particular form in order to ensure the test is filesystem independent
//
// individual real implementations should probably make a careful decision with regards to normalization
// where they are unable to recover the legacy name from the item's config and thus have to rely
// on the name on disk in the filesystem.
String normalized = Normalizer.normalize(s, Normalizer.Form.NFD);
String hash = Util.getDigestOf(normalized);
String base = normalized.toLowerCase(Locale.ENGLISH);
StringBuilder buf = new StringBuilder(32);
for (char c : base.toCharArray()) {
if (buf.length() >= 8) break;
Expand Down

0 comments on commit c9730b1

Please sign in to comment.