@Test(expected=IllegalArgumentException.class) public void parseEmptyTagName() { Tags.parse(new HashMap<String, String>(1), "=bar"); }
public static void parse(final HashMap<String, String> tags, final String tag) { final String[] kv = splitString(tag, '='); if (kv.length != 2 || kv[0].length() <= 0 || kv[1].length() <= 0) { throw new IllegalArgumentException("invalid tag: " + tag); } if (kv[1].equals(tags.get(kv[0]))) { return; } if (tags.get(kv[0]) != null) { throw new IllegalArgumentException("duplicate tag: " + tag + ", tags=" + tags); } tags.put(kv[0], kv[1]); }
Tags { public static void parse(final HashMap<String, String> tags, final String tag) { final String[] kv = splitString(tag, '='); if (kv.length != 2 || kv[0].length() <= 0 || kv[1].length() <= 0) { throw new IllegalArgumentException("invalid tag: " + tag); } if (kv[1].equals(tags.get(kv[0]))) { return; } if (tags.get(kv[0]) != null) { throw new IllegalArgumentException("duplicate tag: " + tag + ", tags=" + tags); } tags.put(kv[0], kv[1]); } }
Tags { public static void parse(final HashMap<String, String> tags, final String tag) { final String[] kv = splitString(tag, '='); if (kv.length != 2 || kv[0].length() <= 0 || kv[1].length() <= 0) { throw new IllegalArgumentException("invalid tag: " + tag); } if (kv[1].equals(tags.get(kv[0]))) { return; } if (tags.get(kv[0]) != null) { throw new IllegalArgumentException("duplicate tag: " + tag + ", tags=" + tags); } tags.put(kv[0], kv[1]); } private  Tags(); }
Tags { public static void parse(final HashMap<String, String> tags, final String tag) { final String[] kv = splitString(tag, '='); if (kv.length != 2 || kv[0].length() <= 0 || kv[1].length() <= 0) { throw new IllegalArgumentException("invalid tag: " + tag); } if (kv[1].equals(tags.get(kv[0]))) { return; } if (tags.get(kv[0]) != null) { throw new IllegalArgumentException("duplicate tag: " + tag + ", tags=" + tags); } tags.put(kv[0], kv[1]); } private  Tags(); static String[] splitString(final String s, final char c); static void parse(final HashMap<String, String> tags,
                             final String tag); static String parseWithMetric(final String metric,
                                         final HashMap<String, String> tags); static long parseLong(final CharSequence s); static boolean looksLikeInteger(final String value); }
Tags { public static void parse(final HashMap<String, String> tags, final String tag) { final String[] kv = splitString(tag, '='); if (kv.length != 2 || kv[0].length() <= 0 || kv[1].length() <= 0) { throw new IllegalArgumentException("invalid tag: " + tag); } if (kv[1].equals(tags.get(kv[0]))) { return; } if (tags.get(kv[0]) != null) { throw new IllegalArgumentException("duplicate tag: " + tag + ", tags=" + tags); } tags.put(kv[0], kv[1]); } private  Tags(); static String[] splitString(final String s, final char c); static void parse(final HashMap<String, String> tags,
                             final String tag); static String parseWithMetric(final String metric,
                                         final HashMap<String, String> tags); static long parseLong(final CharSequence s); static boolean looksLikeInteger(final String value);  }