private XMLPrintStream getErrorOutputStream(String projectName) { if (compileErrorsOut != null) { try { FileOutputStream out = new FileOutputStream(compileErrorsOut); XMLPrintStream p = new XMLPrintStream(out); if ("XML".equalsIgnoreCase(compileErrorsFormat)) { p.printXMLHeader(); p.print("<buildErrors project=\""); p.print(projectName); p.print("\" date=\""); p.print(new Date()); p.println("\">"); } return p; } catch (FileNotFoundException e) { displayError("Could not open error outputfile " + compileErrorsOut.getAbsolutePath()); return null; } } /* else { */ return null; /* } */ }
/** * Append a compilation error to the correct output file if it was specified * * @param resource * @param message * @param lineNum */ private void appendError( XMLPrintStream out, IResource resource, String message, Integer lineNum) { if ("XML".equalsIgnoreCase(compileErrorsFormat)) { out.indent(1); out.print("<Error resource=\""); out.print(resource.getFullPath()); out.print("\" shortName=\""); out.print(resource.getName()); out.print("\" line=\""); out.print(lineNum); out.print("\">"); out.print(message); out.println("</Error>"); } else { out.println(resource.getFullPath() + ":" + lineNum + ": " + message); } }
/** @param out */ private void close(XMLPrintStream p) { if ("XML".equalsIgnoreCase(compileErrorsFormat)) { p.println("</buildErrors>"); } p.close(); }