@Test public void testEscapeIllegalCharacters() throws Exception { Assert.assertEquals("ho_32_no", LegacyAvroSchemaUtil.escapeIllegalCharacters("ho no")); Assert.assertEquals("hell_45_no", LegacyAvroSchemaUtil.escapeIllegalCharacters("hell-no")); Assert.assertEquals("_64_never", LegacyAvroSchemaUtil.escapeIllegalCharacters("@never")); }
public static String escapeIllegalCharacters(String input) { StringBuilder fixed = new StringBuilder(); char c = input.charAt(0); if (!(Character.isLetter(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } for (int i = 1; i < input.length(); i++) { c = input.charAt(i); if (!(Character.isLetterOrDigit(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } } return fixed.toString(); }
LegacyAvroSchemaUtil { public static String escapeIllegalCharacters(String input) { StringBuilder fixed = new StringBuilder(); char c = input.charAt(0); if (!(Character.isLetter(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } for (int i = 1; i < input.length(); i++) { c = input.charAt(i); if (!(Character.isLetterOrDigit(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } } return fixed.toString(); } }
LegacyAvroSchemaUtil { public static String escapeIllegalCharacters(String input) { StringBuilder fixed = new StringBuilder(); char c = input.charAt(0); if (!(Character.isLetter(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } for (int i = 1; i < input.length(); i++) { c = input.charAt(i); if (!(Character.isLetterOrDigit(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } } return fixed.toString(); } private  LegacyAvroSchemaUtil(); }
LegacyAvroSchemaUtil { public static String escapeIllegalCharacters(String input) { StringBuilder fixed = new StringBuilder(); char c = input.charAt(0); if (!(Character.isLetter(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } for (int i = 1; i < input.length(); i++) { c = input.charAt(i); if (!(Character.isLetterOrDigit(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } } return fixed.toString(); } private  LegacyAvroSchemaUtil(); static String escapeIllegalCharacters(String input); }
LegacyAvroSchemaUtil { public static String escapeIllegalCharacters(String input) { StringBuilder fixed = new StringBuilder(); char c = input.charAt(0); if (!(Character.isLetter(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } for (int i = 1; i < input.length(); i++) { c = input.charAt(i); if (!(Character.isLetterOrDigit(c) || c == '_')) { escapeCharacter(c, fixed); } else { fixed.append(c); } } return fixed.toString(); } private  LegacyAvroSchemaUtil(); static String escapeIllegalCharacters(String input);  }