@Test(expected = IllegalArgumentException.class) public void sanitizeTopicNameFail00() { Topics.sanitizeTopicName(null); }
public static List<String> sanitizeTopicName(String topicName) { if (StringUtils.isEmpty(topicName)) throw new IllegalArgumentException("Empty topic name"); if (topicName.contains("+")) throw new IllegalArgumentException("Topic name contains wildcard"); if (topicName.contains("#")) throw new IllegalArgumentException("Topic name contains wildcard"); List<String> levels = new ArrayList<>(); if (topicName.startsWith("/")) topicName = EMPTY + topicName; if (topicName.endsWith("/")) topicName = topicName + EMPTY; String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(topicName, "/"); for (String token : tokens) { levels.add(StringUtils.isNotEmpty(token) ? token : EMPTY); } if (!topicName.endsWith(END)) levels.add(END); return levels; }
Topics { public static List<String> sanitizeTopicName(String topicName) { if (StringUtils.isEmpty(topicName)) throw new IllegalArgumentException("Empty topic name"); if (topicName.contains("+")) throw new IllegalArgumentException("Topic name contains wildcard"); if (topicName.contains("#")) throw new IllegalArgumentException("Topic name contains wildcard"); List<String> levels = new ArrayList<>(); if (topicName.startsWith("/")) topicName = EMPTY + topicName; if (topicName.endsWith("/")) topicName = topicName + EMPTY; String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(topicName, "/"); for (String token : tokens) { levels.add(StringUtils.isNotEmpty(token) ? token : EMPTY); } if (!topicName.endsWith(END)) levels.add(END); return levels; } }
Topics { public static List<String> sanitizeTopicName(String topicName) { if (StringUtils.isEmpty(topicName)) throw new IllegalArgumentException("Empty topic name"); if (topicName.contains("+")) throw new IllegalArgumentException("Topic name contains wildcard"); if (topicName.contains("#")) throw new IllegalArgumentException("Topic name contains wildcard"); List<String> levels = new ArrayList<>(); if (topicName.startsWith("/")) topicName = EMPTY + topicName; if (topicName.endsWith("/")) topicName = topicName + EMPTY; String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(topicName, "/"); for (String token : tokens) { levels.add(StringUtils.isNotEmpty(token) ? token : EMPTY); } if (!topicName.endsWith(END)) levels.add(END); return levels; } private  Topics(); }
Topics { public static List<String> sanitizeTopicName(String topicName) { if (StringUtils.isEmpty(topicName)) throw new IllegalArgumentException("Empty topic name"); if (topicName.contains("+")) throw new IllegalArgumentException("Topic name contains wildcard"); if (topicName.contains("#")) throw new IllegalArgumentException("Topic name contains wildcard"); List<String> levels = new ArrayList<>(); if (topicName.startsWith("/")) topicName = EMPTY + topicName; if (topicName.endsWith("/")) topicName = topicName + EMPTY; String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(topicName, "/"); for (String token : tokens) { levels.add(StringUtils.isNotEmpty(token) ? token : EMPTY); } if (!topicName.endsWith(END)) levels.add(END); return levels; } private  Topics(); static String antidote(String topic); static String antidote(List<String> topicLevels); static List<String> sanitize(String topic); static List<String> sanitizeTopicName(String topicName); static List<String> sanitizeTopicFilter(String topicFilter); static boolean isTopicFilter(List<String> topicLevels); }
Topics { public static List<String> sanitizeTopicName(String topicName) { if (StringUtils.isEmpty(topicName)) throw new IllegalArgumentException("Empty topic name"); if (topicName.contains("+")) throw new IllegalArgumentException("Topic name contains wildcard"); if (topicName.contains("#")) throw new IllegalArgumentException("Topic name contains wildcard"); List<String> levels = new ArrayList<>(); if (topicName.startsWith("/")) topicName = EMPTY + topicName; if (topicName.endsWith("/")) topicName = topicName + EMPTY; String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(topicName, "/"); for (String token : tokens) { levels.add(StringUtils.isNotEmpty(token) ? token : EMPTY); } if (!topicName.endsWith(END)) levels.add(END); return levels; } private  Topics(); static String antidote(String topic); static String antidote(List<String> topicLevels); static List<String> sanitize(String topic); static List<String> sanitizeTopicName(String topicName); static List<String> sanitizeTopicFilter(String topicFilter); static boolean isTopicFilter(List<String> topicLevels); static final String EMPTY; static final String END; }