Skip to content

Commit 6be81ff

Browse files
committed
Use the doclet reporter object to print INFO e WARNING messages.
Errors messages should be handled later. Signed-off-by: Manoel Campos <manoelcampos@gmail.com>
1 parent 9665b8d commit 6be81ff

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/com/github/markusbernhardt/xmldoclet/XmlDoclet.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.apache.commons.cli.*;
1212

1313
import javax.lang.model.SourceVersion;
14+
import javax.tools.Diagnostic;
1415
import javax.xml.transform.stream.StreamSource;
1516
import java.io.*;
1617
import java.nio.charset.Charset;
@@ -194,7 +195,7 @@ public void save(final CommandLine commandLine, final Root root) {
194195
bufferedOutputStream.flush();
195196
fileOutputStream.flush();
196197

197-
LOGGER.info("Wrote XML to: " + xmlFile.getAbsolutePath());
198+
reporter.print(Diagnostic.Kind.NOTE, "Wrote XML to: " + xmlFile.getAbsolutePath());
198199

199200
final var parameters = new HashMap<String, String>();
200201
for (final var option : commandLine.getOptions()) {
@@ -212,7 +213,7 @@ public void save(final CommandLine commandLine, final Root root) {
212213
} catch (Exception ex) {
213214
LOGGER.log(Level.SEVERE, "Failed to write Restructured Text", ex);
214215
}
215-
LOGGER.info("Wrote Restructured Text to: " + outFile.getAbsolutePath());
216+
reporter.print(Diagnostic.Kind.NOTE, "Wrote Restructured Text to: " + outFile.getAbsolutePath());
216217
}
217218

218219
if (commandLine.hasOption("md")) {
@@ -222,15 +223,15 @@ public void save(final CommandLine commandLine, final Root root) {
222223
} catch (Exception ex) {
223224
LOGGER.log(Level.SEVERE, "Failed to write Markdown", ex);
224225
}
225-
LOGGER.info("Wrote Markdown to: " + outFile.getAbsolutePath());
226+
reporter.print(Diagnostic.Kind.NOTE, "Wrote Markdown to: " + outFile.getAbsolutePath());
226227
}
227228

228229
if (commandLine.hasOption("docbook")) {
229-
LOGGER.info("Docbook transformation is not supported yet.");
230+
reporter.print(Diagnostic.Kind.WARNING, "Docbook transformation is not supported yet.");
230231
}
231232

232233
if (commandLine.hasOption("adoc")) {
233-
LOGGER.info("ASCII Doctor transformation is not supported yet.");
234+
reporter.print(Diagnostic.Kind.WARNING, "ASCII transformation is not supported yet.");
234235
}
235236
} catch (RuntimeException | IOException | JAXBException e) {
236237
LOGGER.log(Level.SEVERE, "Failed to write the XML File", e);

0 commit comments

Comments
 (0)