if (value == null || value.trim().length() == 0) {
return new HashMap<String, Map<String, String>>();
}
Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>();
QuotedTokenizer qt = new QuotedTokenizer(value, ";=,");
char del;
do {
boolean hadAttribute = false;
Map<String, String> clause = new HashMap<String, String>();
List<String> aliases = new ArrayList<String>();
aliases.add(qt.nextToken());
del = qt.getSeparator();
while (del == ';') {
String adname = qt.nextToken();
if ((del = qt.getSeparator()) != '=') {
if (hadAttribute) {
throw new IllegalArgumentException("Header contains name field after attribute or directive: " + adname + " from " + value);
}
aliases.add(adname);
} else {
String advalue = qt.nextToken();
clause.put(adname, advalue);
del = qt.getSeparator();
hadAttribute = true;
}
}
for (Iterator<String> i = aliases.iterator(); i.hasNext();) {
result.put(i.next(), clause);