}
return header;
}
private static void addHeader(ManifestFile manifestFile, Header newHeader) {
Section section = manifestFile.getMainSection();
List<Header> headers = manifestFile.getHeaders();
if (section == null) {
manifestFile.add(newHeader.getParent());
}
else if (headers.isEmpty()) {
section.addBefore(newHeader, section.getFirstChild());
}
else {
section.addAfter(newHeader, headers.get(headers.size() - 1));
}
}