mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Mark Craig
31.42.2015 076e388af4b8c87c349da593be0887c3791bf633
CR-6523 OPENDJ-1896 Facilitate debugging man page generation

This patch adds a message on failure that indicates
the command to use for debugging.
1 files modified
15 ■■■■ changed files
opendj-maven-plugin/src/main/java/org/forgerock/opendj/maven/GenerateRefEntriesMojo.java 15 ●●●● patch | view | raw | blame | history
opendj-maven-plugin/src/main/java/org/forgerock/opendj/maven/GenerateRefEntriesMojo.java
@@ -69,6 +69,8 @@
    @Parameter(required = true)
    private File outputDir;
    private static final String EOL = System.getProperty("line.separator");
    /**
     * Writes a RefEntry file to the output directory for each tool.
     * Files names correspond to script names: {@code man-<name>.xml}.
@@ -147,7 +149,16 @@
            process.waitFor();
            final int result = process.exitValue();
            if (result != 0) {
                throw new MojoFailureException("Failed to write page. Tool exit code: " + result);
                final StringBuilder message = new StringBuilder();
                message.append("Failed to write page. Tool exit code: ").append(result).append(EOL);
                message.append("To debug the problem, run the following command and connect your IDE:").append(EOL);
                commands.add(1, "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000");
                for (String arg: commands) {
                    // Surround with quotes to handle trailing sections.
                    message.append("\"").append(arg).append("\"").append(' ');
                }
                message.append(EOL);
                throw new MojoFailureException(message.toString());
            }
        }  catch (InterruptedException e) {
            throw new MojoExecutionException(toolClass + " interrupted", e);
@@ -273,7 +284,7 @@
            String line;
            while ((line = reader.readLine()) != null) {
                writer.write(line);
                writer.write(System.getProperty("line.separator"));
                writer.write(EOL);
            }
        } finally {
            if (writer != null) {