private static List toLines()

in src/main/java/org/apache/maven/plugins/help/DescribeMojo.java [748:779]


    private static List<String> toLines(String text, int indent, int indentSize, int lineLength)
            throws MojoFailureException, MojoExecutionException {
        try {
            Method m =
                    HelpMojo.class.getDeclaredMethod("toLines", String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE);
            m.setAccessible(true);
            @SuppressWarnings("unchecked")
            List<String> output = (List<String>) m.invoke(HelpMojo.class, text, indent, indentSize, lineLength);

            if (output == null) {
                throw new MojoExecutionException("No output was specified.");
            }

            return output;
        } catch (SecurityException e) {
            throw new MojoFailureException("SecurityException: " + e.getMessage());
        } catch (IllegalArgumentException e) {
            throw new MojoFailureException("IllegalArgumentException: " + e.getMessage());
        } catch (NoSuchMethodException e) {
            throw new MojoFailureException("NoSuchMethodException: " + e.getMessage());
        } catch (IllegalAccessException e) {
            throw new MojoFailureException("IllegalAccessException: " + e.getMessage());
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();

            if (cause instanceof NegativeArraySizeException) {
                throw new MojoFailureException("NegativeArraySizeException: " + cause.getMessage());
            }

            throw new MojoFailureException("InvocationTargetException: " + e.getMessage());
        }
    }