if (cl.hasOption('a')) {
OutputStream reportOutput = new ByteArrayOutputStream();
PrintStream stream = new PrintStream(reportOutput, true);
report.report(stream);
AbstractLicenceAppender appender;
String copyrightMsg = cl.getOptionValue("c");
if ( copyrightMsg != null) {
appender = new ApacheV2LicenceAppender(copyrightMsg);
} else {
appender = new ApacheV2LicenceAppender();
}
if (cl.hasOption("f")) {
appender.setForce(true);
}
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
ByteArrayInputStream xmlStream = new ByteArrayInputStream(reportOutput.toString().getBytes("UTF-8"));
Document doc = factory.newDocumentBuilder().parse(xmlStream);
NodeList resourceHeaders = doc.getElementsByTagName("header-type");
String value = null;
for (int i = 0; i < resourceHeaders.getLength(); i++) {
Node headerType = resourceHeaders.item(i).getAttributes().getNamedItem("name");
if(headerType != null) {
value = headerType.getNodeValue();
} else {
value = null;
}
if (value != null &&value.equals("?????")) {
Node resource = resourceHeaders.item(i).getParentNode();
String filename = resource.getAttributes().getNamedItem("name").getNodeValue();
File document = new File(filename);
appender.append(document);
}
}
}
if (cl.hasOption('x')) {