[releng] convert windows EOLs to Unix EOLs
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/bundles/org.eclipse.releng.build.tools.comparator/about.html b/bundles/org.eclipse.releng.build.tools.comparator/about.html
index e2ea9e4..915bc6c 100644
--- a/bundles/org.eclipse.releng.build.tools.comparator/about.html
+++ b/bundles/org.eclipse.releng.build.tools.comparator/about.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>April 18, 2013</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>April 18, 2013</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.releng.build.tools.comparator/plugin.properties b/bundles/org.eclipse.releng.build.tools.comparator/plugin.properties
index 2edae55..7dc9d35 100644
--- a/bundles/org.eclipse.releng.build.tools.comparator/plugin.properties
+++ b/bundles/org.eclipse.releng.build.tools.comparator/plugin.properties
@@ -1,2 +1,2 @@
-Bundle-Vendor = Eclipse Platform Releng
+Bundle-Vendor = Eclipse Platform Releng
Bundle-Name = Comparator Summary Build Tool
\ No newline at end of file
diff --git a/bundles/org.eclipse.releng.build.tools.convert.application/about.html b/bundles/org.eclipse.releng.build.tools.convert.application/about.html
index 96494d2..3989f53 100644
--- a/bundles/org.eclipse.releng.build.tools.convert.application/about.html
+++ b/bundles/org.eclipse.releng.build.tools.convert.application/about.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 11, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 11, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.releng.build.tools.convert.application/src/org/eclipse/releng/build/tools/convert/application/LogConverter.java b/bundles/org.eclipse.releng.build.tools.convert.application/src/org/eclipse/releng/build/tools/convert/application/LogConverter.java
index 17d6546..bf503db 100644
--- a/bundles/org.eclipse.releng.build.tools.convert.application/src/org/eclipse/releng/build/tools/convert/application/LogConverter.java
+++ b/bundles/org.eclipse.releng.build.tools.convert.application/src/org/eclipse/releng/build/tools/convert/application/LogConverter.java
@@ -1,19 +1,19 @@
-
-package org.eclipse.releng.build.tools.convert.application;
-
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-import org.eclipse.releng.build.tools.convert.ant.Converter;
-
-public class LogConverter implements IApplication {
-
- public Object start(final IApplicationContext context) throws Exception {
- final String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
- Converter.main(args);
- return IApplication.EXIT_OK;
- }
-
- public void stop() {
- // nothing to do
- }
-}
+
+package org.eclipse.releng.build.tools.convert.application;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.releng.build.tools.convert.ant.Converter;
+
+public class LogConverter implements IApplication {
+
+ public Object start(final IApplicationContext context) throws Exception {
+ final String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
+ Converter.main(args);
+ return IApplication.EXIT_OK;
+ }
+
+ public void stop() {
+ // nothing to do
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/about.html b/bundles/org.eclipse.releng.build.tools.convert/about.html
index 96494d2..3989f53 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/about.html
+++ b/bundles/org.eclipse.releng.build.tools.convert/about.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 11, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 11, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.releng.build.tools.convert/plugin.properties b/bundles/org.eclipse.releng.build.tools.convert/plugin.properties
index 50cf2a7..cb7feb0 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/plugin.properties
+++ b/bundles/org.eclipse.releng.build.tools.convert/plugin.properties
@@ -1,2 +1,2 @@
-Bundle-Vendor = Eclipse Platform Releng
+Bundle-Vendor = Eclipse Platform Releng
Bundle-Name = Convert Build Tool
\ No newline at end of file
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/Converter.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/Converter.java
index e4b4371..b263b4e 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/Converter.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/Converter.java
@@ -1,378 +1,378 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.ant;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.releng.build.tools.convert.dom.AbstractDOMConverter;
-import org.eclipse.releng.build.tools.convert.dom.IDOMConverter;
-import org.eclipse.releng.build.tools.convert.dom.LogDocumentNode;
-import org.eclipse.releng.build.tools.convert.dom.ProblemNode;
-import org.eclipse.releng.build.tools.convert.dom.ProblemSummaryNode;
-import org.eclipse.releng.build.tools.convert.dom.ProblemsNode;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class Converter {
-
- private static final String HTML_EXTENSION = ".html"; //$NON-NLS-1$
-
- private static final String TXT_EXTENSION = ".txt"; //$NON-NLS-1$
-
- private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
-
- public static final String INPUT_SOURCE = "inputSource"; //$NON-NLS-1$
-
- public static final String CONVERTER_ID = "converterID"; //$NON-NLS-1$
-
- public static final String OUTPUT_FILE_NAME = "outputFileName"; //$NON-NLS-1$
-
- public static final String ENABLE_VALIDATION = "enableValidation"; //$NON-NLS-1$
-
- public static final String RECURSIVE = "recurse"; //$NON-NLS-1$
-
- public static final int FORMAT_VERSION_2 = 2;
-
- public static final int CURRENT_FORMAT_VERSION = FORMAT_VERSION_2;
-
- private static final FileFilter XML_FILTER = new FileFilter() {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * java.io.FileFilter
- * #
- * accept(java.io
- * .File)
- */
- public boolean accept(final File pathname) {
- final String path = pathname.getAbsolutePath().toLowerCase();
- return path.endsWith(XML_EXTENSION) || pathname.isDirectory();
- }
- };
-
- private static void collectAllFiles(final File root, final ArrayList collector, final FileFilter fileFilter) {
- final File[] files = root.listFiles(fileFilter);
- for (int i = 0; i < files.length; i++) {
- final File currentFile = files[i];
- if (currentFile.isDirectory()) {
- collectAllFiles(currentFile, collector, fileFilter);
- } else {
- collector.add(currentFile);
- }
- }
- }
-
- public static File[] getAllFiles(final File root, final FileFilter fileFilter) {
- final ArrayList files = new ArrayList();
- if (root.isDirectory()) {
- collectAllFiles(root, files, fileFilter);
- final File[] result = new File[files.size()];
- files.toArray(result);
- return result;
- }
- return null;
- }
-
- public static void main(final String[] args) {
- try {
- run(args);
- }
- catch (final ParserConfigurationException e) {
- e.printStackTrace();
- }
- }
-
- public static void run(final String[] args) throws ParserConfigurationException {
- final Converter converter = new Converter();
- converter.configure(args);
- converter.parse2();
- }
-
- private final HashMap options;
-
- public Converter() {
- options = new HashMap();
- }
-
- public void configure(final String[] args) {
- if ((args == null) || (args.length == 0)) {
- throw new IllegalArgumentException("Arguments cannot be empty");//$NON-NLS-1$
- }
-
- // set default options
- options.put(ENABLE_VALIDATION, "false"); //$NON-NLS-1$
- int converterID = ConverterFactory.HTML;
-
- final int argCount = args.length;
- int index = 0;
- boolean setOutputFile = false;
- boolean setValidation = false;
- boolean setInputFile = false;
-
- final int DEFAULT_MODE = 0;
- final int OUTPUT_FILE_MODE = 1;
- final int INPUT_FILE_MODE = 2;
-
- int mode = DEFAULT_MODE;
-
- loop: while (index < argCount) {
- final String currentArg = args[index++];
-
- switch (mode) {
- case INPUT_FILE_MODE:
- options.put(INPUT_SOURCE, currentArg);
- mode = DEFAULT_MODE;
- break;
- case OUTPUT_FILE_MODE:
- if (currentArg.toLowerCase().endsWith(TXT_EXTENSION)) {
- converterID = ConverterFactory.TXT;
- }
- options.put(OUTPUT_FILE_NAME, currentArg);
- mode = DEFAULT_MODE;
- continue loop;
- case DEFAULT_MODE:
- if (currentArg.equals("-v")) { //$NON-NLS-1$
- if (setValidation) {
- throw new IllegalArgumentException("Duplicate validation flag"); //$NON-NLS-1$
- }
- setValidation = true;
- options.put(ENABLE_VALIDATION, "true"); //$NON-NLS-1$
- mode = DEFAULT_MODE;
- continue loop;
- }
- if (currentArg.equals("-o")) { //$NON-NLS-1$
- if (setOutputFile) {
- throw new IllegalArgumentException("Duplicate output file"); //$NON-NLS-1$
- }
- setOutputFile = true;
- mode = OUTPUT_FILE_MODE;
- continue loop;
- }
- if (currentArg.equals("-i")) { //$NON-NLS-1$
- if (setInputFile) {
- throw new IllegalArgumentException("Duplicate input file"); //$NON-NLS-1$
- }
- setInputFile = true;
- mode = INPUT_FILE_MODE;
- continue loop;
- }
- if (currentArg.equals("-r")) { //$NON-NLS-1$
- options.put(RECURSIVE, "true"); //$NON-NLS-1$
- mode = DEFAULT_MODE;
- continue loop;
- }
- }
- }
- final String input = (String) options.get(INPUT_SOURCE);
- if (input == null) {
- throw new IllegalArgumentException("An input file or directorty is required"); //$NON-NLS-1$
- }
- if (options.get(RECURSIVE) == null) {
- if (!input.toLowerCase().endsWith(".xml")) { //$NON-NLS-1$
- throw new IllegalArgumentException("Input file must be an xml file"); //$NON-NLS-1$
- }
- }
- options.put(CONVERTER_ID, String.valueOf(converterID));
- }
-
- private void dump(final LogDocumentNode documentNode) {
- final IDOMConverter converter = ConverterFactory.createDOMConverter(Integer.parseInt((String) options
- .get(Converter.CONVERTER_ID)));
- converter.dump(CURRENT_FORMAT_VERSION, options, documentNode);
- }
-
- private String extractNameFrom(final String inputFileName) {
- final int index = inputFileName.lastIndexOf('.');
- switch (Integer.parseInt((String) options.get(Converter.CONVERTER_ID))) {
- case ConverterFactory.TXT:
- return inputFileName.substring(0, index) + TXT_EXTENSION;
- case ConverterFactory.HTML:
- return inputFileName.substring(0, index) + HTML_EXTENSION;
- default:
- return inputFileName.substring(0, index) + HTML_EXTENSION;
- }
- }
-
- public void parse2() throws ParserConfigurationException {
- final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- final boolean validation = Boolean.valueOf((String) options.get(ENABLE_VALIDATION)).booleanValue();
- factory.setValidating(validation);
- factory.setIgnoringElementContentWhitespace(true);
- final DocumentBuilder builder = factory.newDocumentBuilder();
-
- final String inputSourceOption = (String) options.get(INPUT_SOURCE);
- if (options.get(RECURSIVE) != null) {
- // collect all xml files and iterate over them
- final File sourceDir = new File(inputSourceOption);
- if (!sourceDir.exists()) {
- throw new IllegalArgumentException("Directory " + inputSourceOption + " doesn't exist");//$NON-NLS-1$//$NON-NLS-2$
- }
- if (!sourceDir.isDirectory()) {
- throw new IllegalArgumentException(inputSourceOption + " must be a directory in recursive mode");//$NON-NLS-1$
- }
- final File[] xmlFiles = getAllFiles(sourceDir, XML_FILTER);
- for (int i = 0, max = xmlFiles.length; i < max; i++) {
- final String inputFileName = xmlFiles[i].getAbsolutePath();
- final InputSource inputSource = new InputSource(inputFileName);
- final String outputFileName = extractNameFrom(inputFileName);
- options.put(INPUT_SOURCE, inputFileName);
- options.put(OUTPUT_FILE_NAME, outputFileName);
- try {
- builder.setErrorHandler(new DefaultHandler() {
-
- @Override
- public void error(final SAXParseException e) throws SAXException {
- reportError(inputFileName, e);
- throw e;
- }
- });
- final Document document = builder.parse(inputSource);
- final LogDocumentNode documentNode = process(document);
- dump(documentNode);
- }
- catch (final SAXException e) {
- System.out.println(e);
- }
- catch (final IOException e) {
- // ignore
- }
- }
- } else {
- // Parse
- if (inputSourceOption != null) {
- final InputSource inputSource = new InputSource(inputSourceOption);
- if (options.get(OUTPUT_FILE_NAME) == null) {
- options.put(OUTPUT_FILE_NAME, extractNameFrom(inputSourceOption));
- }
- try {
- builder.setErrorHandler(new DefaultHandler() {
-
- @Override
- public void error(final SAXParseException e) throws SAXException {
- reportError(inputSourceOption, e);
- throw e;
- }
- });
- final Document document = builder.parse(inputSource);
- final LogDocumentNode documentNode = process(document);
- dump(documentNode);
- }
- catch (final SAXException e) {
- // ignore
- }
- catch (final IOException e) {
- // ignore
- }
- }
- }
- }
-
- private LogDocumentNode process(final Document document) {
- final LogDocumentNode documentNode = new LogDocumentNode();
- NodeList nodeList = document.getElementsByTagName("problem_summary"); //$NON-NLS-1$
- if (nodeList.getLength() == 1) {
- final Node problemSummaryNode = nodeList.item(0);
- final NamedNodeMap problemSummaryMap = problemSummaryNode.getAttributes();
- final ProblemSummaryNode summaryNode = new ProblemSummaryNode();
- documentNode.setProblemSummary(summaryNode);
- summaryNode.numberOfProblems = Integer.parseInt(problemSummaryMap.getNamedItem("problems").getNodeValue()); //$NON-NLS-1$
- summaryNode.numberOfErrors = Integer.parseInt(problemSummaryMap.getNamedItem("errors").getNodeValue()); //$NON-NLS-1$
- summaryNode.numberOfWarnings = Integer.parseInt(problemSummaryMap.getNamedItem("warnings").getNodeValue()); //$NON-NLS-1$
- }
-
- nodeList = document.getElementsByTagName("problems"); //$NON-NLS-1$
- if (nodeList == null) {
- return null;
- }
-
- final int length = nodeList.getLength();
- int globalErrorNumber = 1;
- for (int i = 0; i < length; i++) {
- final Node problemsNode = nodeList.item(i);
- final ProblemsNode node = new ProblemsNode();
- documentNode.addProblemsNode(node);
- final Node sourceNode = problemsNode.getParentNode();
- final NamedNodeMap sourceNodeMap = sourceNode.getAttributes();
- final String sourceFileName = sourceNodeMap.getNamedItem("path").getNodeValue();//$NON-NLS-1$
- node.sourceFileName = sourceFileName;
- final NamedNodeMap problemsNodeMap = problemsNode.getAttributes();
- node.numberOfErrors = Integer.parseInt(problemsNodeMap.getNamedItem("errors").getNodeValue());//$NON-NLS-1$
- node.numberOfWarnings = Integer.parseInt(problemsNodeMap.getNamedItem("warnings").getNodeValue());//$NON-NLS-1$
- node.numberOfProblems = Integer.parseInt(problemsNodeMap.getNamedItem("problems").getNodeValue());//$NON-NLS-1$
-
- final NodeList children = problemsNode.getChildNodes();
- final int childrenLength = children.getLength();
- for (int j = 0; j < childrenLength; j++) {
- final Node problemNode = children.item(j);
- final NamedNodeMap problemNodeMap = problemNode.getAttributes();
- final String severity = problemNodeMap.getNamedItem("severity").getNodeValue();//$NON-NLS-1$
- final ProblemNode problem = new ProblemNode();
- final boolean isError = "ERROR".equals(severity);//$NON-NLS-1$
- problem.isError = isError;
- problem.id = problemNodeMap.getNamedItem("id").getNodeValue();//$NON-NLS-1$
- if (isError) {
- node.addError(problem);
- } else if (AbstractDOMConverter.FILTERED_WARNINGS_IDS.contains(problem.id)) {
- if (AbstractDOMConverter.FORBIDDEN_REFERENCE.equals(problem.id)) {
- node.addForbiddenWarning(problem);
- } else {
- node.addDiscouragedWarning(problem);
- }
- } else {
- node.addOtherWarning(problem);
- }
- problem.charStart = Integer.parseInt(problemNodeMap.getNamedItem("charStart").getNodeValue());//$NON-NLS-1$
- problem.charEnd = Integer.parseInt(problemNodeMap.getNamedItem("charEnd").getNodeValue());//$NON-NLS-1$
- problem.line = Integer.parseInt(problemNodeMap.getNamedItem("line").getNodeValue());//$NON-NLS-1$
- problem.globalProblemNumber = globalErrorNumber;
- problem.problemNumber = j;
- problem.sourceFileName = sourceFileName;
- globalErrorNumber++;
- final NodeList problemChildren = problemNode.getChildNodes();
- final int problemChildrenLength = problemChildren.getLength();
- for (int n = 0; n < problemChildrenLength; n++) {
- final Node child = problemChildren.item(n);
- final String nodeName = child.getNodeName();
- if ("message".equals(nodeName)) {//$NON-NLS-1$
- final NamedNodeMap childNodeMap = child.getAttributes();
- problem.message = childNodeMap.getNamedItem("value").getNodeValue();//$NON-NLS-1$
- } else if ("source_context".equals(nodeName)) {//$NON-NLS-1$
- final NamedNodeMap childNodeMap = child.getAttributes();
- problem.sourceStart = Integer.parseInt(childNodeMap.getNamedItem("sourceStart").getNodeValue());//$NON-NLS-1$
- problem.sourceEnd = Integer.parseInt(childNodeMap.getNamedItem("sourceEnd").getNodeValue());//$NON-NLS-1$
- problem.contextValue = childNodeMap.getNamedItem("value").getNodeValue();//$NON-NLS-1$
- }
- }
- }
- }
- return documentNode;
- }
-
- void reportError(final String inputFileName, final SAXParseException e) {
- System.err.println("Error in " + inputFileName + " at line " + e.getLineNumber() + " and column " + e.getColumnNumber()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- System.err.println(e.getMessage());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.ant;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.releng.build.tools.convert.dom.AbstractDOMConverter;
+import org.eclipse.releng.build.tools.convert.dom.IDOMConverter;
+import org.eclipse.releng.build.tools.convert.dom.LogDocumentNode;
+import org.eclipse.releng.build.tools.convert.dom.ProblemNode;
+import org.eclipse.releng.build.tools.convert.dom.ProblemSummaryNode;
+import org.eclipse.releng.build.tools.convert.dom.ProblemsNode;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class Converter {
+
+ private static final String HTML_EXTENSION = ".html"; //$NON-NLS-1$
+
+ private static final String TXT_EXTENSION = ".txt"; //$NON-NLS-1$
+
+ private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
+
+ public static final String INPUT_SOURCE = "inputSource"; //$NON-NLS-1$
+
+ public static final String CONVERTER_ID = "converterID"; //$NON-NLS-1$
+
+ public static final String OUTPUT_FILE_NAME = "outputFileName"; //$NON-NLS-1$
+
+ public static final String ENABLE_VALIDATION = "enableValidation"; //$NON-NLS-1$
+
+ public static final String RECURSIVE = "recurse"; //$NON-NLS-1$
+
+ public static final int FORMAT_VERSION_2 = 2;
+
+ public static final int CURRENT_FORMAT_VERSION = FORMAT_VERSION_2;
+
+ private static final FileFilter XML_FILTER = new FileFilter() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * java.io.FileFilter
+ * #
+ * accept(java.io
+ * .File)
+ */
+ public boolean accept(final File pathname) {
+ final String path = pathname.getAbsolutePath().toLowerCase();
+ return path.endsWith(XML_EXTENSION) || pathname.isDirectory();
+ }
+ };
+
+ private static void collectAllFiles(final File root, final ArrayList collector, final FileFilter fileFilter) {
+ final File[] files = root.listFiles(fileFilter);
+ for (int i = 0; i < files.length; i++) {
+ final File currentFile = files[i];
+ if (currentFile.isDirectory()) {
+ collectAllFiles(currentFile, collector, fileFilter);
+ } else {
+ collector.add(currentFile);
+ }
+ }
+ }
+
+ public static File[] getAllFiles(final File root, final FileFilter fileFilter) {
+ final ArrayList files = new ArrayList();
+ if (root.isDirectory()) {
+ collectAllFiles(root, files, fileFilter);
+ final File[] result = new File[files.size()];
+ files.toArray(result);
+ return result;
+ }
+ return null;
+ }
+
+ public static void main(final String[] args) {
+ try {
+ run(args);
+ }
+ catch (final ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void run(final String[] args) throws ParserConfigurationException {
+ final Converter converter = new Converter();
+ converter.configure(args);
+ converter.parse2();
+ }
+
+ private final HashMap options;
+
+ public Converter() {
+ options = new HashMap();
+ }
+
+ public void configure(final String[] args) {
+ if ((args == null) || (args.length == 0)) {
+ throw new IllegalArgumentException("Arguments cannot be empty");//$NON-NLS-1$
+ }
+
+ // set default options
+ options.put(ENABLE_VALIDATION, "false"); //$NON-NLS-1$
+ int converterID = ConverterFactory.HTML;
+
+ final int argCount = args.length;
+ int index = 0;
+ boolean setOutputFile = false;
+ boolean setValidation = false;
+ boolean setInputFile = false;
+
+ final int DEFAULT_MODE = 0;
+ final int OUTPUT_FILE_MODE = 1;
+ final int INPUT_FILE_MODE = 2;
+
+ int mode = DEFAULT_MODE;
+
+ loop: while (index < argCount) {
+ final String currentArg = args[index++];
+
+ switch (mode) {
+ case INPUT_FILE_MODE:
+ options.put(INPUT_SOURCE, currentArg);
+ mode = DEFAULT_MODE;
+ break;
+ case OUTPUT_FILE_MODE:
+ if (currentArg.toLowerCase().endsWith(TXT_EXTENSION)) {
+ converterID = ConverterFactory.TXT;
+ }
+ options.put(OUTPUT_FILE_NAME, currentArg);
+ mode = DEFAULT_MODE;
+ continue loop;
+ case DEFAULT_MODE:
+ if (currentArg.equals("-v")) { //$NON-NLS-1$
+ if (setValidation) {
+ throw new IllegalArgumentException("Duplicate validation flag"); //$NON-NLS-1$
+ }
+ setValidation = true;
+ options.put(ENABLE_VALIDATION, "true"); //$NON-NLS-1$
+ mode = DEFAULT_MODE;
+ continue loop;
+ }
+ if (currentArg.equals("-o")) { //$NON-NLS-1$
+ if (setOutputFile) {
+ throw new IllegalArgumentException("Duplicate output file"); //$NON-NLS-1$
+ }
+ setOutputFile = true;
+ mode = OUTPUT_FILE_MODE;
+ continue loop;
+ }
+ if (currentArg.equals("-i")) { //$NON-NLS-1$
+ if (setInputFile) {
+ throw new IllegalArgumentException("Duplicate input file"); //$NON-NLS-1$
+ }
+ setInputFile = true;
+ mode = INPUT_FILE_MODE;
+ continue loop;
+ }
+ if (currentArg.equals("-r")) { //$NON-NLS-1$
+ options.put(RECURSIVE, "true"); //$NON-NLS-1$
+ mode = DEFAULT_MODE;
+ continue loop;
+ }
+ }
+ }
+ final String input = (String) options.get(INPUT_SOURCE);
+ if (input == null) {
+ throw new IllegalArgumentException("An input file or directorty is required"); //$NON-NLS-1$
+ }
+ if (options.get(RECURSIVE) == null) {
+ if (!input.toLowerCase().endsWith(".xml")) { //$NON-NLS-1$
+ throw new IllegalArgumentException("Input file must be an xml file"); //$NON-NLS-1$
+ }
+ }
+ options.put(CONVERTER_ID, String.valueOf(converterID));
+ }
+
+ private void dump(final LogDocumentNode documentNode) {
+ final IDOMConverter converter = ConverterFactory.createDOMConverter(Integer.parseInt((String) options
+ .get(Converter.CONVERTER_ID)));
+ converter.dump(CURRENT_FORMAT_VERSION, options, documentNode);
+ }
+
+ private String extractNameFrom(final String inputFileName) {
+ final int index = inputFileName.lastIndexOf('.');
+ switch (Integer.parseInt((String) options.get(Converter.CONVERTER_ID))) {
+ case ConverterFactory.TXT:
+ return inputFileName.substring(0, index) + TXT_EXTENSION;
+ case ConverterFactory.HTML:
+ return inputFileName.substring(0, index) + HTML_EXTENSION;
+ default:
+ return inputFileName.substring(0, index) + HTML_EXTENSION;
+ }
+ }
+
+ public void parse2() throws ParserConfigurationException {
+ final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ final boolean validation = Boolean.valueOf((String) options.get(ENABLE_VALIDATION)).booleanValue();
+ factory.setValidating(validation);
+ factory.setIgnoringElementContentWhitespace(true);
+ final DocumentBuilder builder = factory.newDocumentBuilder();
+
+ final String inputSourceOption = (String) options.get(INPUT_SOURCE);
+ if (options.get(RECURSIVE) != null) {
+ // collect all xml files and iterate over them
+ final File sourceDir = new File(inputSourceOption);
+ if (!sourceDir.exists()) {
+ throw new IllegalArgumentException("Directory " + inputSourceOption + " doesn't exist");//$NON-NLS-1$//$NON-NLS-2$
+ }
+ if (!sourceDir.isDirectory()) {
+ throw new IllegalArgumentException(inputSourceOption + " must be a directory in recursive mode");//$NON-NLS-1$
+ }
+ final File[] xmlFiles = getAllFiles(sourceDir, XML_FILTER);
+ for (int i = 0, max = xmlFiles.length; i < max; i++) {
+ final String inputFileName = xmlFiles[i].getAbsolutePath();
+ final InputSource inputSource = new InputSource(inputFileName);
+ final String outputFileName = extractNameFrom(inputFileName);
+ options.put(INPUT_SOURCE, inputFileName);
+ options.put(OUTPUT_FILE_NAME, outputFileName);
+ try {
+ builder.setErrorHandler(new DefaultHandler() {
+
+ @Override
+ public void error(final SAXParseException e) throws SAXException {
+ reportError(inputFileName, e);
+ throw e;
+ }
+ });
+ final Document document = builder.parse(inputSource);
+ final LogDocumentNode documentNode = process(document);
+ dump(documentNode);
+ }
+ catch (final SAXException e) {
+ System.out.println(e);
+ }
+ catch (final IOException e) {
+ // ignore
+ }
+ }
+ } else {
+ // Parse
+ if (inputSourceOption != null) {
+ final InputSource inputSource = new InputSource(inputSourceOption);
+ if (options.get(OUTPUT_FILE_NAME) == null) {
+ options.put(OUTPUT_FILE_NAME, extractNameFrom(inputSourceOption));
+ }
+ try {
+ builder.setErrorHandler(new DefaultHandler() {
+
+ @Override
+ public void error(final SAXParseException e) throws SAXException {
+ reportError(inputSourceOption, e);
+ throw e;
+ }
+ });
+ final Document document = builder.parse(inputSource);
+ final LogDocumentNode documentNode = process(document);
+ dump(documentNode);
+ }
+ catch (final SAXException e) {
+ // ignore
+ }
+ catch (final IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ private LogDocumentNode process(final Document document) {
+ final LogDocumentNode documentNode = new LogDocumentNode();
+ NodeList nodeList = document.getElementsByTagName("problem_summary"); //$NON-NLS-1$
+ if (nodeList.getLength() == 1) {
+ final Node problemSummaryNode = nodeList.item(0);
+ final NamedNodeMap problemSummaryMap = problemSummaryNode.getAttributes();
+ final ProblemSummaryNode summaryNode = new ProblemSummaryNode();
+ documentNode.setProblemSummary(summaryNode);
+ summaryNode.numberOfProblems = Integer.parseInt(problemSummaryMap.getNamedItem("problems").getNodeValue()); //$NON-NLS-1$
+ summaryNode.numberOfErrors = Integer.parseInt(problemSummaryMap.getNamedItem("errors").getNodeValue()); //$NON-NLS-1$
+ summaryNode.numberOfWarnings = Integer.parseInt(problemSummaryMap.getNamedItem("warnings").getNodeValue()); //$NON-NLS-1$
+ }
+
+ nodeList = document.getElementsByTagName("problems"); //$NON-NLS-1$
+ if (nodeList == null) {
+ return null;
+ }
+
+ final int length = nodeList.getLength();
+ int globalErrorNumber = 1;
+ for (int i = 0; i < length; i++) {
+ final Node problemsNode = nodeList.item(i);
+ final ProblemsNode node = new ProblemsNode();
+ documentNode.addProblemsNode(node);
+ final Node sourceNode = problemsNode.getParentNode();
+ final NamedNodeMap sourceNodeMap = sourceNode.getAttributes();
+ final String sourceFileName = sourceNodeMap.getNamedItem("path").getNodeValue();//$NON-NLS-1$
+ node.sourceFileName = sourceFileName;
+ final NamedNodeMap problemsNodeMap = problemsNode.getAttributes();
+ node.numberOfErrors = Integer.parseInt(problemsNodeMap.getNamedItem("errors").getNodeValue());//$NON-NLS-1$
+ node.numberOfWarnings = Integer.parseInt(problemsNodeMap.getNamedItem("warnings").getNodeValue());//$NON-NLS-1$
+ node.numberOfProblems = Integer.parseInt(problemsNodeMap.getNamedItem("problems").getNodeValue());//$NON-NLS-1$
+
+ final NodeList children = problemsNode.getChildNodes();
+ final int childrenLength = children.getLength();
+ for (int j = 0; j < childrenLength; j++) {
+ final Node problemNode = children.item(j);
+ final NamedNodeMap problemNodeMap = problemNode.getAttributes();
+ final String severity = problemNodeMap.getNamedItem("severity").getNodeValue();//$NON-NLS-1$
+ final ProblemNode problem = new ProblemNode();
+ final boolean isError = "ERROR".equals(severity);//$NON-NLS-1$
+ problem.isError = isError;
+ problem.id = problemNodeMap.getNamedItem("id").getNodeValue();//$NON-NLS-1$
+ if (isError) {
+ node.addError(problem);
+ } else if (AbstractDOMConverter.FILTERED_WARNINGS_IDS.contains(problem.id)) {
+ if (AbstractDOMConverter.FORBIDDEN_REFERENCE.equals(problem.id)) {
+ node.addForbiddenWarning(problem);
+ } else {
+ node.addDiscouragedWarning(problem);
+ }
+ } else {
+ node.addOtherWarning(problem);
+ }
+ problem.charStart = Integer.parseInt(problemNodeMap.getNamedItem("charStart").getNodeValue());//$NON-NLS-1$
+ problem.charEnd = Integer.parseInt(problemNodeMap.getNamedItem("charEnd").getNodeValue());//$NON-NLS-1$
+ problem.line = Integer.parseInt(problemNodeMap.getNamedItem("line").getNodeValue());//$NON-NLS-1$
+ problem.globalProblemNumber = globalErrorNumber;
+ problem.problemNumber = j;
+ problem.sourceFileName = sourceFileName;
+ globalErrorNumber++;
+ final NodeList problemChildren = problemNode.getChildNodes();
+ final int problemChildrenLength = problemChildren.getLength();
+ for (int n = 0; n < problemChildrenLength; n++) {
+ final Node child = problemChildren.item(n);
+ final String nodeName = child.getNodeName();
+ if ("message".equals(nodeName)) {//$NON-NLS-1$
+ final NamedNodeMap childNodeMap = child.getAttributes();
+ problem.message = childNodeMap.getNamedItem("value").getNodeValue();//$NON-NLS-1$
+ } else if ("source_context".equals(nodeName)) {//$NON-NLS-1$
+ final NamedNodeMap childNodeMap = child.getAttributes();
+ problem.sourceStart = Integer.parseInt(childNodeMap.getNamedItem("sourceStart").getNodeValue());//$NON-NLS-1$
+ problem.sourceEnd = Integer.parseInt(childNodeMap.getNamedItem("sourceEnd").getNodeValue());//$NON-NLS-1$
+ problem.contextValue = childNodeMap.getNamedItem("value").getNodeValue();//$NON-NLS-1$
+ }
+ }
+ }
+ }
+ return documentNode;
+ }
+
+ void reportError(final String inputFileName, final SAXParseException e) {
+ System.err.println("Error in " + inputFileName + " at line " + e.getLineNumber() + " and column " + e.getColumnNumber()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ System.err.println(e.getMessage());
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/ConverterFactory.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/ConverterFactory.java
index 50c82b5..8b36121 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/ConverterFactory.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/ConverterFactory.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.ant;
-
-import org.eclipse.releng.build.tools.convert.dom.DOMHtmlConverter;
-import org.eclipse.releng.build.tools.convert.dom.DOMTxtConverter;
-import org.eclipse.releng.build.tools.convert.dom.IDOMConverter;
-
-public class ConverterFactory {
-
- public static final String EMPTY = ""; //$NON-NLS-1$
- public static final int TXT = 0;
- public static final int HTML = 1;
-
- public static IDOMConverter createDOMConverter(final int id) {
- switch (id) {
- case TXT:
- return new DOMTxtConverter();
- case HTML:
- return new DOMHtmlConverter();
- default:
- return new DOMHtmlConverter();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.ant;
+
+import org.eclipse.releng.build.tools.convert.dom.DOMHtmlConverter;
+import org.eclipse.releng.build.tools.convert.dom.DOMTxtConverter;
+import org.eclipse.releng.build.tools.convert.dom.IDOMConverter;
+
+public class ConverterFactory {
+
+ public static final String EMPTY = ""; //$NON-NLS-1$
+ public static final int TXT = 0;
+ public static final int HTML = 1;
+
+ public static IDOMConverter createDOMConverter(final int id) {
+ switch (id) {
+ case TXT:
+ return new DOMTxtConverter();
+ case HTML:
+ return new DOMHtmlConverter();
+ default:
+ return new DOMHtmlConverter();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/LogConverterTask.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/LogConverterTask.java
index d7426a1..252af48 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/LogConverterTask.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/LogConverterTask.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.ant;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-/**
- * This ant task is used to convert all xml files inside the given
- * <code>logDirectory</code> and into html or txt files.
- *
- * <p>
- * The resulting files are written in the same directory than the corresponding
- * xml file.
- * </p>
- *
- * <p>
- * This is not intended to be subclassed by users.
- * </p>
- */
-public class LogConverterTask extends Task {
-
- private String input;
-
- private boolean validation;
-
- @Override
- public void execute() throws BuildException {
- if (input == null) {
- throw new BuildException("No input is specified");//$NON-NLS-1$
- }
- try {
- if (isValidation()) {
- Converter.run(new String[] { "-v", "-r", "-i", input }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } else {
- Converter.run(new String[] { "-r", "-i", input }); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- catch (final Exception e) {
- throw new BuildException("Exception during conversion", e);//$NON-NLS-1$
- }
- }
-
- public String getInput() {
- return input;
- }
-
- public boolean isValidation() {
- return validation;
- }
-
- public void setInput(final String logDirectory) {
- input = logDirectory;
- }
-
- public void setValidation(final boolean validation) {
- this.validation = validation;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.ant;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * This ant task is used to convert all xml files inside the given
+ * <code>logDirectory</code> and into html or txt files.
+ *
+ * <p>
+ * The resulting files are written in the same directory than the corresponding
+ * xml file.
+ * </p>
+ *
+ * <p>
+ * This is not intended to be subclassed by users.
+ * </p>
+ */
+public class LogConverterTask extends Task {
+
+ private String input;
+
+ private boolean validation;
+
+ @Override
+ public void execute() throws BuildException {
+ if (input == null) {
+ throw new BuildException("No input is specified");//$NON-NLS-1$
+ }
+ try {
+ if (isValidation()) {
+ Converter.run(new String[] { "-v", "-r", "-i", input }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } else {
+ Converter.run(new String[] { "-r", "-i", input }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ catch (final Exception e) {
+ throw new BuildException("Exception during conversion", e);//$NON-NLS-1$
+ }
+ }
+
+ public String getInput() {
+ return input;
+ }
+
+ public boolean isValidation() {
+ return validation;
+ }
+
+ public void setInput(final String logDirectory) {
+ input = logDirectory;
+ }
+
+ public void setValidation(final boolean validation) {
+ this.validation = validation;
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/Messages.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/Messages.java
index f8c44bc..2c7c102 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/Messages.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/ant/Messages.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.ant;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class Messages {
-
- private final ResourceBundle resourceBundle;
-
- public Messages(final String bundleName) {
- resourceBundle = ResourceBundle.getBundle(bundleName);
- }
-
- public String getString(final String key) {
- try {
- return resourceBundle.getString(key);
- }
- catch (final MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.ant;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+
+ private final ResourceBundle resourceBundle;
+
+ public Messages(final String bundleName) {
+ resourceBundle = ResourceBundle.getBundle(bundleName);
+ }
+
+ public String getString(final String key) {
+ try {
+ return resourceBundle.getString(key);
+ }
+ catch (final MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/AbstractDOMConverter.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/AbstractDOMConverter.java
index 5c44f5d..f5b50fd 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/AbstractDOMConverter.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/AbstractDOMConverter.java
@@ -1,323 +1,323 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.dom;
-
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.text.ChoiceFormat;
-import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.eclipse.releng.build.tools.convert.ant.Converter;
-import org.eclipse.releng.build.tools.convert.ant.Messages;
-
-public abstract class AbstractDOMConverter implements IDOMConverter {
-
- public static final HashSet FILTERED_WARNINGS_IDS;
-
- public static final String FORBIDDEN_REFERENCE = "ForbiddenReference"; //$NON-NLS-1$
- public static final String DISCOURAGED_REFERENCE = "DiscouragedReference"; //$NON-NLS-1$
-
- static {
- FILTERED_WARNINGS_IDS = new HashSet();
- FILTERED_WARNINGS_IDS.add(FORBIDDEN_REFERENCE);
- FILTERED_WARNINGS_IDS.add(DISCOURAGED_REFERENCE);
- }
-
- protected Messages messages;
-
- private String convertToHTML(final String s) {
- final StringBuffer buffer = new StringBuffer();
- for (int i = 0, max = s.length(); i < max; i++) {
- final char c = s.charAt(i);
- switch (c) {
- case '<':
- buffer.append("<"); //$NON-NLS-1$
- break;
- case '>':
- buffer.append(">"); //$NON-NLS-1$
- break;
- case '\"':
- buffer.append("""); //$NON-NLS-1$
- break;
- case '&':
- buffer.append("&"); //$NON-NLS-1$
- break;
- case '^':
- buffer.append("∧"); //$NON-NLS-1$
- break;
- default:
- buffer.append(c);
- }
- }
- return String.valueOf(buffer);
- }
-
- public void dump(final int formatVersion, final Map options, final LogDocumentNode documentNode) {
- switch (formatVersion) {
- case Converter.FORMAT_VERSION_2:
- dumpVersion2(options, documentNode);
- }
- }
-
- private void dumpVersion2(final Map options, final LogDocumentNode documentNode) {
- final String fileName = (String) options.get(Converter.OUTPUT_FILE_NAME);
- final ProblemSummaryNode summaryNode = documentNode.getSummaryNode();
- if ((summaryNode == null) || ((summaryNode.numberOfErrors == 0) && (summaryNode.numberOfWarnings == 0))) {
- return;
- }
- try {
- final Writer writer = new BufferedWriter(new FileWriter(fileName));
- final String pluginName = extractPluginName(fileName);
- if (pluginName == null) {
- writer.write(messages.getString("header")); //$NON-NLS-1$
- } else {
- final String pattern = messages.getString("dom_header"); //$NON-NLS-1$
- writer.write(MessageFormat.format(pattern,
- new Object[] { pluginName, extractXmlFileName((String) options.get(Converter.INPUT_SOURCE)) }));
- }
- final ProblemSummaryNode problemSummaryNode = summaryNode;
- writeTopAnchor(writer);
- String pattern = messages.getString("problem.summary"); //$NON-NLS-1$
- writer.write(MessageFormat.format(pattern, new Object[] { Integer.toString(problemSummaryNode.numberOfProblems),
- Integer.toString(problemSummaryNode.numberOfErrors), Integer.toString(problemSummaryNode.numberOfWarnings) }));
-
- writeAnchorsReferences(writer);
- final ProblemsNode[] problemsNodes = documentNode.getProblems();
- int globalErrorNumber = 1;
-
- writeErrorAnchor(writer);
- writeAnchorsReferencesErrors(writer);
- // dump errors
- for (int i = 0, max = problemsNodes.length; i < max; i++) {
- final ProblemsNode problemsNode = problemsNodes[i];
- final ProblemNode[] problemNodes = problemsNode.getErrors();
- final int length = problemNodes.length;
- if (length == 0) {
- continue;
- }
- pattern = messages.getString("errors.header"); //$NON-NLS-1$
-
- final MessageFormat form = new MessageFormat(pattern);
- final double[] warningsLimits = { 1, 2 };
- final String[] warningParts = { messages.getString("one_error"), //$NON-NLS-1$
- messages.getString("multiple_errors") //$NON-NLS-1$
- };
- final ChoiceFormat warningForm = new ChoiceFormat(warningsLimits, warningParts);
- final String sourceFileName = extractRelativePath(problemsNode.sourceFileName, pluginName);
- form.setFormatByArgumentIndex(1, warningForm);
- final Object[] arguments = new Object[] { sourceFileName, new Integer(problemsNode.numberOfErrors), };
- writer.write(form.format(arguments));
- for (int j = 0; j < length; j++) {
- final ProblemNode problemNode = problemNodes[j];
- if ((j & 1) != 0) {
- pattern = messages.getString("errors.entry.odd"); //$NON-NLS-1$
- } else {
- pattern = messages.getString("errors.entry.even"); //$NON-NLS-1$
- }
- problemNode.setSources();
- writer.write(MessageFormat.format(
- pattern,
- new Object[] { sourceFileName, Integer.toString(globalErrorNumber), Integer.toString(j + 1),
- problemNode.id, Integer.toString(problemNode.line), convertToHTML(problemNode.message),
- convertToHTML(problemNode.sourceCodeBefore), convertToHTML(problemNode.sourceCode),
- convertToHTML(problemNode.sourceCodeAfter),
- getUnderLine(problemNode.sourceCodeBefore, problemNode.sourceCodeAfter),
- Integer.toString(problemNode.charStart), Integer.toString(problemNode.charEnd), }));
- globalErrorNumber++;
- }
- writer.write(messages.getString("errors.footer")); //$NON-NLS-1$
- }
-
- writeOtherWarningsAnchor(writer);
- writeAnchorsReferencesOtherWarnings(writer);
- // dump other warnings
- for (int i = 0, max = problemsNodes.length; i < max; i++) {
- final ProblemsNode problemsNode = problemsNodes[i];
- final ProblemNode[] problemNodes = problemsNode.getOtherWarnings();
- final int length = problemNodes.length;
- if (length == 0) {
- continue;
- }
-
- pattern = messages.getString("other_warnings.header"); //$NON-NLS-1$
- final MessageFormat form = new MessageFormat(pattern);
- final double[] warningsLimits = { 1, 2 };
- final String[] warningParts = { messages.getString("one_warning"),//$NON-NLS-1$
- messages.getString("multiple_warnings") //$NON-NLS-1$
- };
- final ChoiceFormat warningForm = new ChoiceFormat(warningsLimits, warningParts);
- final String sourceFileName = extractRelativePath(problemsNode.sourceFileName, pluginName);
- form.setFormatByArgumentIndex(1, warningForm);
- final Object[] arguments = new Object[] { sourceFileName, new Integer(problemsNode.numberOfWarnings), };
- writer.write(form.format(arguments));
- for (int j = 0; j < length; j++) {
- final ProblemNode problemNode = problemNodes[j];
- if ((j & 1) != 0) {
- pattern = messages.getString("warnings.entry.odd"); //$NON-NLS-1$
- } else {
- pattern = messages.getString("warnings.entry.even"); //$NON-NLS-1$
- }
- problemNode.setSources();
- writer.write(MessageFormat.format(
- pattern,
- new Object[] { sourceFileName, Integer.toString(globalErrorNumber), Integer.toString(j + 1),
- problemNode.id, Integer.toString(problemNode.line), convertToHTML(problemNode.message),
- convertToHTML(problemNode.sourceCodeBefore), convertToHTML(problemNode.sourceCode),
- convertToHTML(problemNode.sourceCodeAfter),
- getUnderLine(problemNode.sourceCodeBefore, problemNode.sourceCodeAfter),
- Integer.toString(problemNode.charStart), Integer.toString(problemNode.charEnd), }));
- globalErrorNumber++;
- }
- writer.write(messages.getString("other_warnings.footer")); //$NON-NLS-1$
- }
-
- // dump forbidden accesses warnings
- writeForbiddenRulesWarningsAnchor(writer);
- writeAnchorsReferencesForbiddenRulesWarnings(writer);
- for (int i = 0, max = problemsNodes.length; i < max; i++) {
- final ProblemsNode problemsNode = problemsNodes[i];
- final ProblemNode[] problemNodes = problemsNode.getForbiddenWarnings();
- final int length = problemNodes.length;
- if (length == 0) {
- continue;
- }
-
- pattern = messages.getString("forbidden_warnings.header"); //$NON-NLS-1$
- final MessageFormat form = new MessageFormat(pattern);
- final double[] warningsLimits = { 1, 2 };
- final String[] warningParts = { messages.getString("one_warning"),//$NON-NLS-1$
- messages.getString("multiple_warnings") //$NON-NLS-1$
- };
- final ChoiceFormat warningForm = new ChoiceFormat(warningsLimits, warningParts);
- final String sourceFileName = extractRelativePath(problemsNode.sourceFileName, pluginName);
- form.setFormatByArgumentIndex(1, warningForm);
- final Object[] arguments = new Object[] { sourceFileName, new Integer(problemsNode.numberOfWarnings), };
- writer.write(form.format(arguments));
- for (int j = 0; j < length; j++) {
- final ProblemNode problemNode = problemNodes[j];
- if ((j & 1) != 0) {
- pattern = messages.getString("warnings.entry.odd"); //$NON-NLS-1$
- } else {
- pattern = messages.getString("warnings.entry.even"); //$NON-NLS-1$
- }
- problemNode.setSources();
- writer.write(MessageFormat.format(
- pattern,
- new Object[] { sourceFileName, Integer.toString(globalErrorNumber), Integer.toString(j + 1),
- problemNode.id, Integer.toString(problemNode.line), convertToHTML(problemNode.message),
- convertToHTML(problemNode.sourceCodeBefore), convertToHTML(problemNode.sourceCode),
- convertToHTML(problemNode.sourceCodeAfter),
- getUnderLine(problemNode.sourceCodeBefore, problemNode.sourceCodeAfter),
- Integer.toString(problemNode.charStart), Integer.toString(problemNode.charEnd), }));
- globalErrorNumber++;
- }
- writer.write(messages.getString("forbidden_warnings.footer")); //$NON-NLS-1$
- }
-
- // dump discouraged accesses warnings
- writeDiscouragedRulesWarningsAnchor(writer);
- writeAnchorsReferencesDiscouragedRulesWarnings(writer);
- for (int i = 0, max = problemsNodes.length; i < max; i++) {
- final ProblemsNode problemsNode = problemsNodes[i];
- final ProblemNode[] problemNodes = problemsNode.getDiscouragedWarnings();
- final int length = problemNodes.length;
- if (length == 0) {
- continue;
- }
-
- pattern = messages.getString("discouraged_warnings.header"); //$NON-NLS-1$
- final MessageFormat form = new MessageFormat(pattern);
- final double[] warningsLimits = { 1, 2 };
- final String[] warningParts = { messages.getString("one_warning"),//$NON-NLS-1$
- messages.getString("multiple_warnings") //$NON-NLS-1$
- };
- final ChoiceFormat warningForm = new ChoiceFormat(warningsLimits, warningParts);
- final String sourceFileName = extractRelativePath(problemsNode.sourceFileName, pluginName);
- form.setFormatByArgumentIndex(1, warningForm);
- final Object[] arguments = new Object[] { sourceFileName, new Integer(problemsNode.numberOfWarnings), };
- writer.write(form.format(arguments));
- for (int j = 0; j < length; j++) {
- final ProblemNode problemNode = problemNodes[j];
- if ((j & 1) != 0) {
- pattern = messages.getString("warnings.entry.odd"); //$NON-NLS-1$
- } else {
- pattern = messages.getString("warnings.entry.even"); //$NON-NLS-1$
- }
- problemNode.setSources();
- writer.write(MessageFormat.format(
- pattern,
- new Object[] { sourceFileName, Integer.toString(globalErrorNumber), Integer.toString(j + 1),
- problemNode.id, Integer.toString(problemNode.line), convertToHTML(problemNode.message),
- convertToHTML(problemNode.sourceCodeBefore), convertToHTML(problemNode.sourceCode),
- convertToHTML(problemNode.sourceCodeAfter),
- getUnderLine(problemNode.sourceCodeBefore, problemNode.sourceCodeAfter),
- Integer.toString(problemNode.charStart), Integer.toString(problemNode.charEnd), }));
- globalErrorNumber++;
- }
- writer.write(messages.getString("discouraged_warnings.footer")); //$NON-NLS-1$
- }
-
- writer.write(messages.getString("footer")); //$NON-NLS-1$
- writer.flush();
- writer.close();
- }
- catch (final IOException e) {
- // ignore
- }
- }
-
- private String extractPluginName(final String fileName) {
- // fileName is fully qualified and we want to extract the segment before
- // the log file name
- // file name contains only '/'
- final String logName = fileName.replace('\\', '/');
- final int index = logName.lastIndexOf('/');
- if (index == -1) {
- return null;
- }
- final int index2 = logName.lastIndexOf('/', index - 1);
- if (index2 == -1) {
- return null;
- }
- return logName.substring(index2 + 1, index);
- }
-
- private String extractRelativePath(final String sourceFileName, final String pluginName) {
- if (pluginName == null) {
- return sourceFileName;
- }
- final int index = pluginName.indexOf('_');
- if (index == -1) {
- return sourceFileName;
- }
- final String pluginShortName = pluginName.substring(0, index);
- final int index2 = sourceFileName.indexOf(pluginShortName);
- if (index2 == -1) {
- return sourceFileName;
- }
- return sourceFileName.substring(index2 + pluginShortName.length(), sourceFileName.length());
- }
-
- private String extractXmlFileName(final String fileName) {
- // fileName is fully qualified and we want to extract the segment before
- // the log file name
- // file name contains only '/'
- final String logName = fileName.replace('\\', '/');
- final int index = logName.lastIndexOf('/');
- if (index == -1) {
- return null;
- }
- return logName.substring(index + 1, logName.length());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.dom;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.text.ChoiceFormat;
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.releng.build.tools.convert.ant.Converter;
+import org.eclipse.releng.build.tools.convert.ant.Messages;
+
+public abstract class AbstractDOMConverter implements IDOMConverter {
+
+ public static final HashSet FILTERED_WARNINGS_IDS;
+
+ public static final String FORBIDDEN_REFERENCE = "ForbiddenReference"; //$NON-NLS-1$
+ public static final String DISCOURAGED_REFERENCE = "DiscouragedReference"; //$NON-NLS-1$
+
+ static {
+ FILTERED_WARNINGS_IDS = new HashSet();
+ FILTERED_WARNINGS_IDS.add(FORBIDDEN_REFERENCE);
+ FILTERED_WARNINGS_IDS.add(DISCOURAGED_REFERENCE);
+ }
+
+ protected Messages messages;
+
+ private String convertToHTML(final String s) {
+ final StringBuffer buffer = new StringBuffer();
+ for (int i = 0, max = s.length(); i < max; i++) {
+ final char c = s.charAt(i);
+ switch (c) {
+ case '<':
+ buffer.append("<"); //$NON-NLS-1$
+ break;
+ case '>':
+ buffer.append(">"); //$NON-NLS-1$
+ break;
+ case '\"':
+ buffer.append("""); //$NON-NLS-1$
+ break;
+ case '&':
+ buffer.append("&"); //$NON-NLS-1$
+ break;
+ case '^':
+ buffer.append("∧"); //$NON-NLS-1$
+ break;
+ default:
+ buffer.append(c);
+ }
+ }
+ return String.valueOf(buffer);
+ }
+
+ public void dump(final int formatVersion, final Map options, final LogDocumentNode documentNode) {
+ switch (formatVersion) {
+ case Converter.FORMAT_VERSION_2:
+ dumpVersion2(options, documentNode);
+ }
+ }
+
+ private void dumpVersion2(final Map options, final LogDocumentNode documentNode) {
+ final String fileName = (String) options.get(Converter.OUTPUT_FILE_NAME);
+ final ProblemSummaryNode summaryNode = documentNode.getSummaryNode();
+ if ((summaryNode == null) || ((summaryNode.numberOfErrors == 0) && (summaryNode.numberOfWarnings == 0))) {
+ return;
+ }
+ try {
+ final Writer writer = new BufferedWriter(new FileWriter(fileName));
+ final String pluginName = extractPluginName(fileName);
+ if (pluginName == null) {
+ writer.write(messages.getString("header")); //$NON-NLS-1$
+ } else {
+ final String pattern = messages.getString("dom_header"); //$NON-NLS-1$
+ writer.write(MessageFormat.format(pattern,
+ new Object[] { pluginName, extractXmlFileName((String) options.get(Converter.INPUT_SOURCE)) }));
+ }
+ final ProblemSummaryNode problemSummaryNode = summaryNode;
+ writeTopAnchor(writer);
+ String pattern = messages.getString("problem.summary"); //$NON-NLS-1$
+ writer.write(MessageFormat.format(pattern, new Object[] { Integer.toString(problemSummaryNode.numberOfProblems),
+ Integer.toString(problemSummaryNode.numberOfErrors), Integer.toString(problemSummaryNode.numberOfWarnings) }));
+
+ writeAnchorsReferences(writer);
+ final ProblemsNode[] problemsNodes = documentNode.getProblems();
+ int globalErrorNumber = 1;
+
+ writeErrorAnchor(writer);
+ writeAnchorsReferencesErrors(writer);
+ // dump errors
+ for (int i = 0, max = problemsNodes.length; i < max; i++) {
+ final ProblemsNode problemsNode = problemsNodes[i];
+ final ProblemNode[] problemNodes = problemsNode.getErrors();
+ final int length = problemNodes.length;
+ if (length == 0) {
+ continue;
+ }
+ pattern = messages.getString("errors.header"); //$NON-NLS-1$
+
+ final MessageFormat form = new MessageFormat(pattern);
+ final double[] warningsLimits = { 1, 2 };
+ final String[] warningParts = { messages.getString("one_error"), //$NON-NLS-1$
+ messages.getString("multiple_errors") //$NON-NLS-1$
+ };
+ final ChoiceFormat warningForm = new ChoiceFormat(warningsLimits, warningParts);
+ final String sourceFileName = extractRelativePath(problemsNode.sourceFileName, pluginName);
+ form.setFormatByArgumentIndex(1, warningForm);
+ final Object[] arguments = new Object[] { sourceFileName, new Integer(problemsNode.numberOfErrors), };
+ writer.write(form.format(arguments));
+ for (int j = 0; j < length; j++) {
+ final ProblemNode problemNode = problemNodes[j];
+ if ((j & 1) != 0) {
+ pattern = messages.getString("errors.entry.odd"); //$NON-NLS-1$
+ } else {
+ pattern = messages.getString("errors.entry.even"); //$NON-NLS-1$
+ }
+ problemNode.setSources();
+ writer.write(MessageFormat.format(
+ pattern,
+ new Object[] { sourceFileName, Integer.toString(globalErrorNumber), Integer.toString(j + 1),
+ problemNode.id, Integer.toString(problemNode.line), convertToHTML(problemNode.message),
+ convertToHTML(problemNode.sourceCodeBefore), convertToHTML(problemNode.sourceCode),
+ convertToHTML(problemNode.sourceCodeAfter),
+ getUnderLine(problemNode.sourceCodeBefore, problemNode.sourceCodeAfter),
+ Integer.toString(problemNode.charStart), Integer.toString(problemNode.charEnd), }));
+ globalErrorNumber++;
+ }
+ writer.write(messages.getString("errors.footer")); //$NON-NLS-1$
+ }
+
+ writeOtherWarningsAnchor(writer);
+ writeAnchorsReferencesOtherWarnings(writer);
+ // dump other warnings
+ for (int i = 0, max = problemsNodes.length; i < max; i++) {
+ final ProblemsNode problemsNode = problemsNodes[i];
+ final ProblemNode[] problemNodes = problemsNode.getOtherWarnings();
+ final int length = problemNodes.length;
+ if (length == 0) {
+ continue;
+ }
+
+ pattern = messages.getString("other_warnings.header"); //$NON-NLS-1$
+ final MessageFormat form = new MessageFormat(pattern);
+ final double[] warningsLimits = { 1, 2 };
+ final String[] warningParts = { messages.getString("one_warning"),//$NON-NLS-1$
+ messages.getString("multiple_warnings") //$NON-NLS-1$
+ };
+ final ChoiceFormat warningForm = new ChoiceFormat(warningsLimits, warningParts);
+ final String sourceFileName = extractRelativePath(problemsNode.sourceFileName, pluginName);
+ form.setFormatByArgumentIndex(1, warningForm);
+ final Object[] arguments = new Object[] { sourceFileName, new Integer(problemsNode.numberOfWarnings), };
+ writer.write(form.format(arguments));
+ for (int j = 0; j < length; j++) {
+ final ProblemNode problemNode = problemNodes[j];
+ if ((j & 1) != 0) {
+ pattern = messages.getString("warnings.entry.odd"); //$NON-NLS-1$
+ } else {
+ pattern = messages.getString("warnings.entry.even"); //$NON-NLS-1$
+ }
+ problemNode.setSources();
+ writer.write(MessageFormat.format(
+ pattern,
+ new Object[] { sourceFileName, Integer.toString(globalErrorNumber), Integer.toString(j + 1),
+ problemNode.id, Integer.toString(problemNode.line), convertToHTML(problemNode.message),
+ convertToHTML(problemNode.sourceCodeBefore), convertToHTML(problemNode.sourceCode),
+ convertToHTML(problemNode.sourceCodeAfter),
+ getUnderLine(problemNode.sourceCodeBefore, problemNode.sourceCodeAfter),
+ Integer.toString(problemNode.charStart), Integer.toString(problemNode.charEnd), }));
+ globalErrorNumber++;
+ }
+ writer.write(messages.getString("other_warnings.footer")); //$NON-NLS-1$
+ }
+
+ // dump forbidden accesses warnings
+ writeForbiddenRulesWarningsAnchor(writer);
+ writeAnchorsReferencesForbiddenRulesWarnings(writer);
+ for (int i = 0, max = problemsNodes.length; i < max; i++) {
+ final ProblemsNode problemsNode = problemsNodes[i];
+ final ProblemNode[] problemNodes = problemsNode.getForbiddenWarnings();
+ final int length = problemNodes.length;
+ if (length == 0) {
+ continue;
+ }
+
+ pattern = messages.getString("forbidden_warnings.header"); //$NON-NLS-1$
+ final MessageFormat form = new MessageFormat(pattern);
+ final double[] warningsLimits = { 1, 2 };
+ final String[] warningParts = { messages.getString("one_warning"),//$NON-NLS-1$
+ messages.getString("multiple_warnings") //$NON-NLS-1$
+ };
+ final ChoiceFormat warningForm = new ChoiceFormat(warningsLimits, warningParts);
+ final String sourceFileName = extractRelativePath(problemsNode.sourceFileName, pluginName);
+ form.setFormatByArgumentIndex(1, warningForm);
+ final Object[] arguments = new Object[] { sourceFileName, new Integer(problemsNode.numberOfWarnings), };
+ writer.write(form.format(arguments));
+ for (int j = 0; j < length; j++) {
+ final ProblemNode problemNode = problemNodes[j];
+ if ((j & 1) != 0) {
+ pattern = messages.getString("warnings.entry.odd"); //$NON-NLS-1$
+ } else {
+ pattern = messages.getString("warnings.entry.even"); //$NON-NLS-1$
+ }
+ problemNode.setSources();
+ writer.write(MessageFormat.format(
+ pattern,
+ new Object[] { sourceFileName, Integer.toString(globalErrorNumber), Integer.toString(j + 1),
+ problemNode.id, Integer.toString(problemNode.line), convertToHTML(problemNode.message),
+ convertToHTML(problemNode.sourceCodeBefore), convertToHTML(problemNode.sourceCode),
+ convertToHTML(problemNode.sourceCodeAfter),
+ getUnderLine(problemNode.sourceCodeBefore, problemNode.sourceCodeAfter),
+ Integer.toString(problemNode.charStart), Integer.toString(problemNode.charEnd), }));
+ globalErrorNumber++;
+ }
+ writer.write(messages.getString("forbidden_warnings.footer")); //$NON-NLS-1$
+ }
+
+ // dump discouraged accesses warnings
+ writeDiscouragedRulesWarningsAnchor(writer);
+ writeAnchorsReferencesDiscouragedRulesWarnings(writer);
+ for (int i = 0, max = problemsNodes.length; i < max; i++) {
+ final ProblemsNode problemsNode = problemsNodes[i];
+ final ProblemNode[] problemNodes = problemsNode.getDiscouragedWarnings();
+ final int length = problemNodes.length;
+ if (length == 0) {
+ continue;
+ }
+
+ pattern = messages.getString("discouraged_warnings.header"); //$NON-NLS-1$
+ final MessageFormat form = new MessageFormat(pattern);
+ final double[] warningsLimits = { 1, 2 };
+ final String[] warningParts = { messages.getString("one_warning"),//$NON-NLS-1$
+ messages.getString("multiple_warnings") //$NON-NLS-1$
+ };
+ final ChoiceFormat warningForm = new ChoiceFormat(warningsLimits, warningParts);
+ final String sourceFileName = extractRelativePath(problemsNode.sourceFileName, pluginName);
+ form.setFormatByArgumentIndex(1, warningForm);
+ final Object[] arguments = new Object[] { sourceFileName, new Integer(problemsNode.numberOfWarnings), };
+ writer.write(form.format(arguments));
+ for (int j = 0; j < length; j++) {
+ final ProblemNode problemNode = problemNodes[j];
+ if ((j & 1) != 0) {
+ pattern = messages.getString("warnings.entry.odd"); //$NON-NLS-1$
+ } else {
+ pattern = messages.getString("warnings.entry.even"); //$NON-NLS-1$
+ }
+ problemNode.setSources();
+ writer.write(MessageFormat.format(
+ pattern,
+ new Object[] { sourceFileName, Integer.toString(globalErrorNumber), Integer.toString(j + 1),
+ problemNode.id, Integer.toString(problemNode.line), convertToHTML(problemNode.message),
+ convertToHTML(problemNode.sourceCodeBefore), convertToHTML(problemNode.sourceCode),
+ convertToHTML(problemNode.sourceCodeAfter),
+ getUnderLine(problemNode.sourceCodeBefore, problemNode.sourceCodeAfter),
+ Integer.toString(problemNode.charStart), Integer.toString(problemNode.charEnd), }));
+ globalErrorNumber++;
+ }
+ writer.write(messages.getString("discouraged_warnings.footer")); //$NON-NLS-1$
+ }
+
+ writer.write(messages.getString("footer")); //$NON-NLS-1$
+ writer.flush();
+ writer.close();
+ }
+ catch (final IOException e) {
+ // ignore
+ }
+ }
+
+ private String extractPluginName(final String fileName) {
+ // fileName is fully qualified and we want to extract the segment before
+ // the log file name
+ // file name contains only '/'
+ final String logName = fileName.replace('\\', '/');
+ final int index = logName.lastIndexOf('/');
+ if (index == -1) {
+ return null;
+ }
+ final int index2 = logName.lastIndexOf('/', index - 1);
+ if (index2 == -1) {
+ return null;
+ }
+ return logName.substring(index2 + 1, index);
+ }
+
+ private String extractRelativePath(final String sourceFileName, final String pluginName) {
+ if (pluginName == null) {
+ return sourceFileName;
+ }
+ final int index = pluginName.indexOf('_');
+ if (index == -1) {
+ return sourceFileName;
+ }
+ final String pluginShortName = pluginName.substring(0, index);
+ final int index2 = sourceFileName.indexOf(pluginShortName);
+ if (index2 == -1) {
+ return sourceFileName;
+ }
+ return sourceFileName.substring(index2 + pluginShortName.length(), sourceFileName.length());
+ }
+
+ private String extractXmlFileName(final String fileName) {
+ // fileName is fully qualified and we want to extract the segment before
+ // the log file name
+ // file name contains only '/'
+ final String logName = fileName.replace('\\', '/');
+ final int index = logName.lastIndexOf('/');
+ if (index == -1) {
+ return null;
+ }
+ return logName.substring(index + 1, logName.length());
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/DOMHtmlConverter.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/DOMHtmlConverter.java
index a66e20a..c6162dc 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/DOMHtmlConverter.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/DOMHtmlConverter.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.dom;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.eclipse.releng.build.tools.convert.ant.ConverterFactory;
-import org.eclipse.releng.build.tools.convert.ant.Messages;
-
-public class DOMHtmlConverter extends AbstractDOMConverter {
-
- public DOMHtmlConverter() {
- //this.messages = new Messages("org.eclipse.releng.build.tools.convert.ant.html_messages"); //$NON-NLS-1$
- messages = new Messages("org.eclipse.releng.build.tools.convert.ant.html_messages"); //$NON-NLS-1$
- }
-
- public String getUnderLine(final String sourceBefore, final String sourceOfError) {
- return ConverterFactory.EMPTY;
- }
-
- public void writeAnchorsReferences(final Writer writer) throws IOException {
- writer.write(messages.getString("anchors.references.no_top"));//$NON-NLS-1$
- }
-
- public void writeAnchorsReferencesDiscouragedRulesWarnings(final Writer writer) throws IOException {
- writer.write(messages.getString("anchors.references.no_discouraged_warnings"));//$NON-NLS-1$
- }
-
- public void writeAnchorsReferencesErrors(final Writer writer) throws IOException {
- writer.write(messages.getString("anchors.references.no_errors"));//$NON-NLS-1$
- }
-
- public void writeAnchorsReferencesForbiddenRulesWarnings(final Writer writer) throws IOException {
- writer.write(messages.getString("anchors.references.no_forbidden_warnings"));//$NON-NLS-1$
- }
-
- public void writeAnchorsReferencesOtherWarnings(final Writer writer) throws IOException {
- writer.write(messages.getString("anchors.references.no_other_warnings"));//$NON-NLS-1$
- }
-
- public void writeDiscouragedRulesWarningsAnchor(final Writer writer) throws IOException {
- writer.write(messages.getString("discouraged_warnings.title_anchor"));//$NON-NLS-1$
- }
-
- public void writeErrorAnchor(final Writer writer) throws IOException {
- writer.write(messages.getString("errors.title_anchor"));//$NON-NLS-1$
- }
-
- public void writeForbiddenRulesWarningsAnchor(final Writer writer) throws IOException {
- writer.write(messages.getString("forbidden_warnings.title_anchor"));//$NON-NLS-1$
- }
-
- public void writeOtherWarningsAnchor(final Writer writer) throws IOException {
- writer.write(messages.getString("other_warnings.title_anchor"));//$NON-NLS-1$
- }
-
- public void writeTopAnchor(final Writer writer) throws IOException {
- writer.write(messages.getString("problem.summary.title_anchor"));//$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.dom;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.eclipse.releng.build.tools.convert.ant.ConverterFactory;
+import org.eclipse.releng.build.tools.convert.ant.Messages;
+
+public class DOMHtmlConverter extends AbstractDOMConverter {
+
+ public DOMHtmlConverter() {
+ //this.messages = new Messages("org.eclipse.releng.build.tools.convert.ant.html_messages"); //$NON-NLS-1$
+ messages = new Messages("org.eclipse.releng.build.tools.convert.ant.html_messages"); //$NON-NLS-1$
+ }
+
+ public String getUnderLine(final String sourceBefore, final String sourceOfError) {
+ return ConverterFactory.EMPTY;
+ }
+
+ public void writeAnchorsReferences(final Writer writer) throws IOException {
+ writer.write(messages.getString("anchors.references.no_top"));//$NON-NLS-1$
+ }
+
+ public void writeAnchorsReferencesDiscouragedRulesWarnings(final Writer writer) throws IOException {
+ writer.write(messages.getString("anchors.references.no_discouraged_warnings"));//$NON-NLS-1$
+ }
+
+ public void writeAnchorsReferencesErrors(final Writer writer) throws IOException {
+ writer.write(messages.getString("anchors.references.no_errors"));//$NON-NLS-1$
+ }
+
+ public void writeAnchorsReferencesForbiddenRulesWarnings(final Writer writer) throws IOException {
+ writer.write(messages.getString("anchors.references.no_forbidden_warnings"));//$NON-NLS-1$
+ }
+
+ public void writeAnchorsReferencesOtherWarnings(final Writer writer) throws IOException {
+ writer.write(messages.getString("anchors.references.no_other_warnings"));//$NON-NLS-1$
+ }
+
+ public void writeDiscouragedRulesWarningsAnchor(final Writer writer) throws IOException {
+ writer.write(messages.getString("discouraged_warnings.title_anchor"));//$NON-NLS-1$
+ }
+
+ public void writeErrorAnchor(final Writer writer) throws IOException {
+ writer.write(messages.getString("errors.title_anchor"));//$NON-NLS-1$
+ }
+
+ public void writeForbiddenRulesWarningsAnchor(final Writer writer) throws IOException {
+ writer.write(messages.getString("forbidden_warnings.title_anchor"));//$NON-NLS-1$
+ }
+
+ public void writeOtherWarningsAnchor(final Writer writer) throws IOException {
+ writer.write(messages.getString("other_warnings.title_anchor"));//$NON-NLS-1$
+ }
+
+ public void writeTopAnchor(final Writer writer) throws IOException {
+ writer.write(messages.getString("problem.summary.title_anchor"));//$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/DOMTxtConverter.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/DOMTxtConverter.java
index b7c5d77..c2b6e0c 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/DOMTxtConverter.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/DOMTxtConverter.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.dom;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.eclipse.releng.build.tools.convert.ant.Messages;
-
-public class DOMTxtConverter extends AbstractDOMConverter {
-
- public DOMTxtConverter() {
- messages = new Messages("org.eclipse.releng.build.tools.convert.ant.txt_messages"); //$NON-NLS-1$
- }
-
- public String getUnderLine(final String sourceBefore, final String sourceOfError) {
- final StringBuffer buffer = new StringBuffer();
- char[] chars = sourceBefore.toCharArray();
- for (int i = 0, max = chars.length; i < max; i++) {
- switch (chars[i]) {
- case '\t':
- buffer.append('\t');
- break;
- default:
- buffer.append(' ');
- }
- }
- chars = sourceOfError.toCharArray();
- for (int i = 0, max = chars.length; i < max; i++) {
- buffer.append('^');
- }
- return String.valueOf(buffer);
- }
-
- public void writeAnchorsReferences(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeAnchorsReferencesDiscouragedRulesWarnings(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeAnchorsReferencesErrors(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeAnchorsReferencesForbiddenRulesWarnings(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeAnchorsReferencesOtherWarnings(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeDiscouragedRulesWarningsAnchor(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeErrorAnchor(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeForbiddenRulesWarningsAnchor(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeOtherWarningsAnchor(final Writer writer) throws IOException {
- // do nothing
- }
-
- public void writeTopAnchor(final Writer writer) throws IOException {
- // do nothing
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.dom;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.eclipse.releng.build.tools.convert.ant.Messages;
+
+public class DOMTxtConverter extends AbstractDOMConverter {
+
+ public DOMTxtConverter() {
+ messages = new Messages("org.eclipse.releng.build.tools.convert.ant.txt_messages"); //$NON-NLS-1$
+ }
+
+ public String getUnderLine(final String sourceBefore, final String sourceOfError) {
+ final StringBuffer buffer = new StringBuffer();
+ char[] chars = sourceBefore.toCharArray();
+ for (int i = 0, max = chars.length; i < max; i++) {
+ switch (chars[i]) {
+ case '\t':
+ buffer.append('\t');
+ break;
+ default:
+ buffer.append(' ');
+ }
+ }
+ chars = sourceOfError.toCharArray();
+ for (int i = 0, max = chars.length; i < max; i++) {
+ buffer.append('^');
+ }
+ return String.valueOf(buffer);
+ }
+
+ public void writeAnchorsReferences(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeAnchorsReferencesDiscouragedRulesWarnings(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeAnchorsReferencesErrors(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeAnchorsReferencesForbiddenRulesWarnings(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeAnchorsReferencesOtherWarnings(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeDiscouragedRulesWarningsAnchor(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeErrorAnchor(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeForbiddenRulesWarningsAnchor(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeOtherWarningsAnchor(final Writer writer) throws IOException {
+ // do nothing
+ }
+
+ public void writeTopAnchor(final Writer writer) throws IOException {
+ // do nothing
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/IDOMConverter.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/IDOMConverter.java
index 1d02e7c..779efa5 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/IDOMConverter.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/IDOMConverter.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.dom;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Map;
-
-public interface IDOMConverter {
-
- void dump(int formatVersion, Map options, LogDocumentNode documentNode);
-
- String getUnderLine(String sourceBefore, String sourceOfError);
-
- void writeAnchorsReferences(Writer writer) throws IOException;
-
- void writeAnchorsReferencesDiscouragedRulesWarnings(Writer writer) throws IOException;
-
- void writeAnchorsReferencesErrors(Writer writer) throws IOException;
-
- void writeAnchorsReferencesForbiddenRulesWarnings(Writer writer) throws IOException;
-
- void writeAnchorsReferencesOtherWarnings(Writer writer) throws IOException;
-
- void writeDiscouragedRulesWarningsAnchor(Writer writer) throws IOException;
-
- void writeErrorAnchor(Writer writer) throws IOException;
-
- void writeForbiddenRulesWarningsAnchor(Writer writer) throws IOException;
-
- void writeOtherWarningsAnchor(Writer writer) throws IOException;
-
- void writeTopAnchor(Writer writer) throws IOException;
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.dom;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Map;
+
+public interface IDOMConverter {
+
+ void dump(int formatVersion, Map options, LogDocumentNode documentNode);
+
+ String getUnderLine(String sourceBefore, String sourceOfError);
+
+ void writeAnchorsReferences(Writer writer) throws IOException;
+
+ void writeAnchorsReferencesDiscouragedRulesWarnings(Writer writer) throws IOException;
+
+ void writeAnchorsReferencesErrors(Writer writer) throws IOException;
+
+ void writeAnchorsReferencesForbiddenRulesWarnings(Writer writer) throws IOException;
+
+ void writeAnchorsReferencesOtherWarnings(Writer writer) throws IOException;
+
+ void writeDiscouragedRulesWarningsAnchor(Writer writer) throws IOException;
+
+ void writeErrorAnchor(Writer writer) throws IOException;
+
+ void writeForbiddenRulesWarningsAnchor(Writer writer) throws IOException;
+
+ void writeOtherWarningsAnchor(Writer writer) throws IOException;
+
+ void writeTopAnchor(Writer writer) throws IOException;
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/LogDocumentNode.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/LogDocumentNode.java
index 8060e57..09a8630 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/LogDocumentNode.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/LogDocumentNode.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.dom;
-
-import java.util.ArrayList;
-
-public class LogDocumentNode {
-
- private static final ProblemsNode[] NO_PROBLEM_NODES = new ProblemsNode[0];
- private ArrayList problems;
- private ProblemSummaryNode summaryNode;
- private ProblemsNode[] problemsNodes;
-
- public void addProblemsNode(final ProblemsNode node) {
- if (problems == null) {
- problems = new ArrayList();
- }
- problems.add(node);
- }
-
- public ProblemsNode[] getProblems() {
- if (problemsNodes != null) {
- return problemsNodes;
- }
- if (problems == null) {
- return problemsNodes = NO_PROBLEM_NODES;
- }
- problemsNodes = new ProblemsNode[problems.size()];
- problems.toArray(problemsNodes);
- return problemsNodes;
- }
-
- public ProblemSummaryNode getSummaryNode() {
- return summaryNode;
- }
-
- public void setProblemSummary(final ProblemSummaryNode node) {
- summaryNode = node;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.dom;
+
+import java.util.ArrayList;
+
+public class LogDocumentNode {
+
+ private static final ProblemsNode[] NO_PROBLEM_NODES = new ProblemsNode[0];
+ private ArrayList problems;
+ private ProblemSummaryNode summaryNode;
+ private ProblemsNode[] problemsNodes;
+
+ public void addProblemsNode(final ProblemsNode node) {
+ if (problems == null) {
+ problems = new ArrayList();
+ }
+ problems.add(node);
+ }
+
+ public ProblemsNode[] getProblems() {
+ if (problemsNodes != null) {
+ return problemsNodes;
+ }
+ if (problems == null) {
+ return problemsNodes = NO_PROBLEM_NODES;
+ }
+ problemsNodes = new ProblemsNode[problems.size()];
+ problems.toArray(problemsNodes);
+ return problemsNodes;
+ }
+
+ public ProblemSummaryNode getSummaryNode() {
+ return summaryNode;
+ }
+
+ public void setProblemSummary(final ProblemSummaryNode node) {
+ summaryNode = node;
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemNode.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemNode.java
index 225b64a..c41df8a 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemNode.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemNode.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.dom;
-
-public class ProblemNode {
-
- protected static final String EMPTY = ""; //$NON-NLS-1$
-
- public boolean isError;
- public int charStart;
- public int charEnd;
- public int line;
- public String id;
- public String message;
- public int sourceStart;
- public int sourceEnd;
- public String contextValue;
- public int globalProblemNumber;
- public int problemNumber;
- public String sourceFileName;
-
- public String sourceCodeBefore;
- public String sourceCodeAfter;
- public String sourceCode;
-
- public void setSources() {
- if ((sourceStart == -1) || (sourceEnd == -1)) {
- sourceCodeBefore = EMPTY;
- sourceCode = contextValue;
- sourceCodeAfter = EMPTY;
- } else {
- final int length = contextValue.length();
- if (sourceStart < length) {
- sourceCodeBefore = contextValue.substring(0, sourceStart);
- final int end = sourceEnd + 1;
- if (end < length) {
- sourceCode = contextValue.substring(sourceStart, end);
- sourceCodeAfter = contextValue.substring(end, length);
- } else {
- sourceCode = contextValue.substring(sourceStart, length);
- sourceCodeAfter = EMPTY;
- }
- } else {
- sourceCodeBefore = EMPTY;
- sourceCode = EMPTY;
- sourceCodeAfter = EMPTY;
- }
- }
- }
-
- @Override
- public String toString() {
- final StringBuffer buffer = new StringBuffer();
- buffer.append(isError ? "ERROR " : "WARNING "); //$NON-NLS-1$//$NON-NLS-2$
- buffer.append("line : ").append(line).append(" message = ").append(message);//$NON-NLS-1$//$NON-NLS-2$
- return buffer.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.dom;
+
+public class ProblemNode {
+
+ protected static final String EMPTY = ""; //$NON-NLS-1$
+
+ public boolean isError;
+ public int charStart;
+ public int charEnd;
+ public int line;
+ public String id;
+ public String message;
+ public int sourceStart;
+ public int sourceEnd;
+ public String contextValue;
+ public int globalProblemNumber;
+ public int problemNumber;
+ public String sourceFileName;
+
+ public String sourceCodeBefore;
+ public String sourceCodeAfter;
+ public String sourceCode;
+
+ public void setSources() {
+ if ((sourceStart == -1) || (sourceEnd == -1)) {
+ sourceCodeBefore = EMPTY;
+ sourceCode = contextValue;
+ sourceCodeAfter = EMPTY;
+ } else {
+ final int length = contextValue.length();
+ if (sourceStart < length) {
+ sourceCodeBefore = contextValue.substring(0, sourceStart);
+ final int end = sourceEnd + 1;
+ if (end < length) {
+ sourceCode = contextValue.substring(sourceStart, end);
+ sourceCodeAfter = contextValue.substring(end, length);
+ } else {
+ sourceCode = contextValue.substring(sourceStart, length);
+ sourceCodeAfter = EMPTY;
+ }
+ } else {
+ sourceCodeBefore = EMPTY;
+ sourceCode = EMPTY;
+ sourceCodeAfter = EMPTY;
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ final StringBuffer buffer = new StringBuffer();
+ buffer.append(isError ? "ERROR " : "WARNING "); //$NON-NLS-1$//$NON-NLS-2$
+ buffer.append("line : ").append(line).append(" message = ").append(message);//$NON-NLS-1$//$NON-NLS-2$
+ return buffer.toString();
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemSummaryNode.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemSummaryNode.java
index e1f6d85..ac77d03 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemSummaryNode.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemSummaryNode.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.dom;
-
-public class ProblemSummaryNode {
-
- public int numberOfProblems;
- public int numberOfErrors;
- public int numberOfWarnings;
-
- @Override
- public String toString() {
- final StringBuffer buffer = new StringBuffer();
- buffer.append("problems : ") //$NON-NLS-1$
- .append(numberOfProblems).append(" errors : ") //$NON-NLS-1$
- .append(numberOfErrors).append(" warnings : ") //$NON-NLS-1$
- .append(numberOfWarnings);
- return buffer.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.dom;
+
+public class ProblemSummaryNode {
+
+ public int numberOfProblems;
+ public int numberOfErrors;
+ public int numberOfWarnings;
+
+ @Override
+ public String toString() {
+ final StringBuffer buffer = new StringBuffer();
+ buffer.append("problems : ") //$NON-NLS-1$
+ .append(numberOfProblems).append(" errors : ") //$NON-NLS-1$
+ .append(numberOfErrors).append(" warnings : ") //$NON-NLS-1$
+ .append(numberOfWarnings);
+ return buffer.toString();
+ }
+}
diff --git a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemsNode.java b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemsNode.java
index bceaf9c..be271ba 100644
--- a/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemsNode.java
+++ b/bundles/org.eclipse.releng.build.tools.convert/src/org/eclipse/releng/build/tools/convert/dom/ProblemsNode.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.releng.build.tools.convert.dom;
-
-import java.util.ArrayList;
-
-public class ProblemsNode {
-
- private static final ProblemNode[] EMPTY_NODES = new ProblemNode[0];
-
- public String sourceFileName;
- public int numberOfProblems;
- public int numberOfErrors;
- public int numberOfWarnings;
-
- private ArrayList errorNodes;
- private ArrayList otherWarningNodes;
- private ArrayList discouragedWarningsNodes;
- private ArrayList forbiddenWarningsNodes;
- private ProblemNode[] errors;
- private ProblemNode[] otherWarnings;
- private ProblemNode[] discouragedWarnings;
- private ProblemNode[] forbiddenWarnings;
-
- public void addDiscouragedWarning(final ProblemNode node) {
- if (discouragedWarningsNodes == null) {
- discouragedWarningsNodes = new ArrayList();
- }
- discouragedWarningsNodes.add(node);
- }
-
- public void addError(final ProblemNode node) {
- if (errorNodes == null) {
- errorNodes = new ArrayList();
- }
- errorNodes.add(node);
- }
-
- public void addForbiddenWarning(final ProblemNode node) {
- if (forbiddenWarningsNodes == null) {
- forbiddenWarningsNodes = new ArrayList();
- }
- forbiddenWarningsNodes.add(node);
- }
-
- public void addOtherWarning(final ProblemNode node) {
- if (otherWarningNodes == null) {
- otherWarningNodes = new ArrayList();
- }
- otherWarningNodes.add(node);
- }
-
- public ProblemNode[] getDiscouragedWarnings() {
- if (discouragedWarnings != null) {
- return discouragedWarnings;
- }
- if (discouragedWarningsNodes == null) {
- return discouragedWarnings = EMPTY_NODES;
- }
- discouragedWarnings = new ProblemNode[discouragedWarningsNodes.size()];
- discouragedWarningsNodes.toArray(discouragedWarnings);
- return discouragedWarnings;
- }
-
- public ProblemNode[] getErrors() {
- if (errors != null) {
- return errors;
- }
- if (errorNodes == null) {
- return errors = EMPTY_NODES;
- }
- errors = new ProblemNode[errorNodes.size()];
- errorNodes.toArray(errors);
- return errors;
- }
-
- public ProblemNode[] getForbiddenWarnings() {
- if (forbiddenWarnings != null) {
- return forbiddenWarnings;
- }
- if (forbiddenWarningsNodes == null) {
- return forbiddenWarnings = EMPTY_NODES;
- }
- forbiddenWarnings = new ProblemNode[forbiddenWarningsNodes.size()];
- forbiddenWarningsNodes.toArray(forbiddenWarnings);
- return forbiddenWarnings;
- }
-
- public ProblemNode[] getOtherWarnings() {
- if (otherWarnings != null) {
- return otherWarnings;
- }
- if (otherWarningNodes == null) {
- return otherWarnings = EMPTY_NODES;
- }
- otherWarnings = new ProblemNode[otherWarningNodes.size()];
- otherWarningNodes.toArray(otherWarnings);
- return otherWarnings;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.releng.build.tools.convert.dom;
+
+import java.util.ArrayList;
+
+public class ProblemsNode {
+
+ private static final ProblemNode[] EMPTY_NODES = new ProblemNode[0];
+
+ public String sourceFileName;
+ public int numberOfProblems;
+ public int numberOfErrors;
+ public int numberOfWarnings;
+
+ private ArrayList errorNodes;
+ private ArrayList otherWarningNodes;
+ private ArrayList discouragedWarningsNodes;
+ private ArrayList forbiddenWarningsNodes;
+ private ProblemNode[] errors;
+ private ProblemNode[] otherWarnings;
+ private ProblemNode[] discouragedWarnings;
+ private ProblemNode[] forbiddenWarnings;
+
+ public void addDiscouragedWarning(final ProblemNode node) {
+ if (discouragedWarningsNodes == null) {
+ discouragedWarningsNodes = new ArrayList();
+ }
+ discouragedWarningsNodes.add(node);
+ }
+
+ public void addError(final ProblemNode node) {
+ if (errorNodes == null) {
+ errorNodes = new ArrayList();
+ }
+ errorNodes.add(node);
+ }
+
+ public void addForbiddenWarning(final ProblemNode node) {
+ if (forbiddenWarningsNodes == null) {
+ forbiddenWarningsNodes = new ArrayList();
+ }
+ forbiddenWarningsNodes.add(node);
+ }
+
+ public void addOtherWarning(final ProblemNode node) {
+ if (otherWarningNodes == null) {
+ otherWarningNodes = new ArrayList();
+ }
+ otherWarningNodes.add(node);
+ }
+
+ public ProblemNode[] getDiscouragedWarnings() {
+ if (discouragedWarnings != null) {
+ return discouragedWarnings;
+ }
+ if (discouragedWarningsNodes == null) {
+ return discouragedWarnings = EMPTY_NODES;
+ }
+ discouragedWarnings = new ProblemNode[discouragedWarningsNodes.size()];
+ discouragedWarningsNodes.toArray(discouragedWarnings);
+ return discouragedWarnings;
+ }
+
+ public ProblemNode[] getErrors() {
+ if (errors != null) {
+ return errors;
+ }
+ if (errorNodes == null) {
+ return errors = EMPTY_NODES;
+ }
+ errors = new ProblemNode[errorNodes.size()];
+ errorNodes.toArray(errors);
+ return errors;
+ }
+
+ public ProblemNode[] getForbiddenWarnings() {
+ if (forbiddenWarnings != null) {
+ return forbiddenWarnings;
+ }
+ if (forbiddenWarningsNodes == null) {
+ return forbiddenWarnings = EMPTY_NODES;
+ }
+ forbiddenWarnings = new ProblemNode[forbiddenWarningsNodes.size()];
+ forbiddenWarningsNodes.toArray(forbiddenWarnings);
+ return forbiddenWarnings;
+ }
+
+ public ProblemNode[] getOtherWarnings() {
+ if (otherWarnings != null) {
+ return otherWarnings;
+ }
+ if (otherWarningNodes == null) {
+ return otherWarnings = EMPTY_NODES;
+ }
+ otherWarnings = new ProblemNode[otherWarningNodes.size()];
+ otherWarningNodes.toArray(otherWarnings);
+ return otherWarnings;
+ }
+}