@Test public void testSanitizeHostName() throws Exception { assertEquals("somehost.lan", IdGenerator.sanitizeHostName("somehost.lan")); assertEquals("otherhost.lan", IdGenerator.sanitizeHostName("other\u0E08host.lan")); }
protected static String sanitizeHostName(String hostName) { boolean changed = false; StringBuilder sb = new StringBuilder(); for (char ch : hostName.toCharArray()) { if (ch < 127) { sb.append(ch); } else { changed = true; } } if (changed) { String newHost = sb.toString(); LOG.info("Sanitized hostname from: {} to: {}", hostName, newHost); return newHost; } else { return hostName; } }
IdGenerator { protected static String sanitizeHostName(String hostName) { boolean changed = false; StringBuilder sb = new StringBuilder(); for (char ch : hostName.toCharArray()) { if (ch < 127) { sb.append(ch); } else { changed = true; } } if (changed) { String newHost = sb.toString(); LOG.info("Sanitized hostname from: {} to: {}", hostName, newHost); return newHost; } else { return hostName; } } }
IdGenerator { protected static String sanitizeHostName(String hostName) { boolean changed = false; StringBuilder sb = new StringBuilder(); for (char ch : hostName.toCharArray()) { if (ch < 127) { sb.append(ch); } else { changed = true; } } if (changed) { String newHost = sb.toString(); LOG.info("Sanitized hostname from: {} to: {}", hostName, newHost); return newHost; } else { return hostName; } } IdGenerator(String prefix);  IdGenerator(); }
IdGenerator { protected static String sanitizeHostName(String hostName) { boolean changed = false; StringBuilder sb = new StringBuilder(); for (char ch : hostName.toCharArray()) { if (ch < 127) { sb.append(ch); } else { changed = true; } } if (changed) { String newHost = sb.toString(); LOG.info("Sanitized hostname from: {} to: {}", hostName, newHost); return newHost; } else { return hostName; } } IdGenerator(String prefix);  IdGenerator(); String generateId(); }
IdGenerator { protected static String sanitizeHostName(String hostName) { boolean changed = false; StringBuilder sb = new StringBuilder(); for (char ch : hostName.toCharArray()) { if (ch < 127) { sb.append(ch); } else { changed = true; } } if (changed) { String newHost = sb.toString(); LOG.info("Sanitized hostname from: {} to: {}", hostName, newHost); return newHost; } else { return hostName; } } IdGenerator(String prefix);  IdGenerator(); String generateId(); static final String DEFAULT_PREFIX; static final String PROPERTY_IDGENERATOR_HOST_PREFIX; }