use of java.util.jar.Attributes.Name in project bnd by bndtools.
the class Analyzer method merge.
/**
* @param manifests
* @throws Exception
*/
private void merge(Manifest result, Manifest old) {
if (old != null) {
for (Iterator<Map.Entry<Object, Object>> e = old.getMainAttributes().entrySet().iterator(); e.hasNext(); ) {
Map.Entry<Object, Object> entry = e.next();
Attributes.Name name = (Attributes.Name) entry.getKey();
String value = (String) entry.getValue();
if (name.toString().equalsIgnoreCase(Constants.CREATED_BY))
name = new Attributes.Name("Originally-Created-By");
if (!result.getMainAttributes().containsKey(name))
result.getMainAttributes().put(name, value);
}
// do not overwrite existing entries
Map<String, Attributes> oldEntries = old.getEntries();
Map<String, Attributes> newEntries = result.getEntries();
for (Iterator<Map.Entry<String, Attributes>> e = oldEntries.entrySet().iterator(); e.hasNext(); ) {
Map.Entry<String, Attributes> entry = e.next();
if (!newEntries.containsKey(entry.getKey())) {
newEntries.put(entry.getKey(), entry.getValue());
}
}
}
}
Aggregations