Example usage for org.apache.maven.exception ExceptionSummary getException

List of usage examples for org.apache.maven.exception ExceptionSummary getException

Introduction

In this page you can find the example usage for org.apache.maven.exception ExceptionSummary getException.

Prototype

public Throwable getException() 

Source Link

Usage

From source file:hudson.maven.util.ExecutionEventLogger.java

License:Apache License

private void logErrorSummary(ExceptionSummary summary, Map<String, String> references, String indent,
        boolean showErrors) {
    String referenceKey = "";

    if (StringUtils.isNotEmpty(summary.getReference())) {
        referenceKey = references.get(summary.getReference());
        if (referenceKey == null) {
            referenceKey = "[Help " + (references.size() + 1) + "]";
            references.put(summary.getReference(), referenceKey);
        }//www. j  av a2s  .  c  o m
    }

    String msg = summary.getMessage();

    if (StringUtils.isNotEmpty(referenceKey)) {
        if (msg.indexOf('\n') < 0) {
            msg += " -> " + referenceKey;
        } else {
            msg += "\n-> " + referenceKey;
        }
    }

    String[] lines = msg.split("(\r\n)|(\r)|(\n)");

    for (int i = 0; i < lines.length; i++) {
        String line = indent + lines[i].trim();

        if (i == lines.length - 1
                && (showErrors || (summary.getException() instanceof InternalErrorException))) {
            logger.error(line, summary.getException());
        } else {
            logger.error(line);
        }
    }

    indent += "  ";

    for (ExceptionSummary child : summary.getChildren()) {
        logErrorSummary(child, references, indent, showErrors);
    }
}

From source file:org.commonjava.emb.boot.embed.EMBEmbedder.java

License:Apache License

protected void logSummary(final ExceptionSummary summary, final Map<String, String> references, String indent,
        final boolean showErrors) {
    String referenceKey = "";

    if (StringUtils.isNotEmpty(summary.getReference())) {
        referenceKey = references.get(summary.getReference());
        if (referenceKey == null) {
            referenceKey = "[Help " + (references.size() + 1) + "]";
            references.put(summary.getReference(), referenceKey);
        }//  ww w.  ja v  a  2 s .  com
    }

    String msg = indent + summary.getMessage();

    if (StringUtils.isNotEmpty(referenceKey)) {
        if (msg.indexOf('\n') < 0) {
            msg += " -> " + referenceKey;
        } else {
            msg += '\n' + indent + "-> " + referenceKey;
        }
    }

    if (showErrors) {
        logger.error(msg, summary.getException());
    } else {
        logger.error(msg);
    }

    indent += "  ";

    for (final ExceptionSummary child : summary.getChildren()) {
        logSummary(child, references, indent, showErrors);
    }
}

From source file:org.kie.workbench.common.services.backend.compiler.external339.AFMavenCli.java

License:Apache License

protected void logSummary(ExceptionSummary summary, Map<String, String> references, String indent,
        boolean showErrors) {
    String referenceKey = "";

    if (StringUtils.isNotEmpty(summary.getReference())) {
        referenceKey = references.get(summary.getReference());
        if (referenceKey == null) {
            referenceKey = "[Help " + (references.size() + 1) + "]";
            references.put(summary.getReference(), referenceKey);
        }//  w w  w. j a v  a2  s. c o  m
    }

    String msg = summary.getMessage();

    if (StringUtils.isNotEmpty(referenceKey)) {
        if (msg.indexOf('\n') < 0) {
            msg += " -> " + referenceKey;
        } else {
            msg += "\n-> " + referenceKey;
        }
    }

    String[] lines = msg.split("(\r\n)|(\r)|(\n)");

    for (int i = 0; i < lines.length; i++) {
        String line = indent + lines[i].trim();

        if ((i == lines.length - 1)
                && (showErrors || (summary.getException() instanceof InternalErrorException))) {
            slf4jLogger.error(line, summary.getException());
        } else {
            slf4jLogger.error(line);
        }
    }

    indent += "  ";

    for (ExceptionSummary child : summary.getChildren()) {
        logSummary(child, references, indent, showErrors);
    }
}

From source file:org.kie.workbench.common.services.backend.compiler.impl.external339.ReusableAFMavenCli.java

License:Apache License

protected void logSummary(ExceptionSummary summary, Map<String, String> references, String indent,
        boolean showErrors) {
    String referenceKey = "";

    if (StringUtils.isNotEmpty(summary.getReference())) {
        referenceKey = references.get(summary.getReference());
        if (referenceKey == null) {
            referenceKey = "[Help " + (references.size() + 1) + "]";
            references.put(summary.getReference(), referenceKey);
        }/* w  w  w.  j a v a2s.  c  om*/
    }

    String msg = summary.getMessage();

    if (StringUtils.isNotEmpty(referenceKey)) {
        if (msg.indexOf('\n') < 0) {
            msg += " -> " + referenceKey;
        } else {
            msg += "\n-> " + referenceKey;
        }
    }

    String[] lines = msg.split("(\r\n)|(\r)|(\n)");

    for (int i = 0; i < lines.length; i++) {
        String line = indent + lines[i].trim();

        if ((i == lines.length - 1)
                && (showErrors || (summary.getException() instanceof InternalErrorException))) {
            reusableSlf4jLogger.error(line, summary.getException());
        } else {
            reusableSlf4jLogger.error(line);
        }
    }

    indent += "  ";

    for (ExceptionSummary child : summary.getChildren()) {
        logSummary(child, references, indent, showErrors);
    }
}

From source file:org.topdesk.maven.tracker.MavenCli.java

License:Apache License

private void logSummary(ExceptionSummary summary, Map<String, String> references, String indent,
        boolean showErrors) {
    String referenceKey = "";

    if (StringUtils.isNotEmpty(summary.getReference())) {
        referenceKey = references.get(summary.getReference());
        if (referenceKey == null) {
            referenceKey = "[Help " + (references.size() + 1) + "]";
            references.put(summary.getReference(), referenceKey);
        }//from  w  w w  . j a v  a  2  s  . c  om
    }

    String msg = summary.getMessage();

    if (StringUtils.isNotEmpty(referenceKey)) {
        if (msg.indexOf('\n') < 0) {
            msg += " -> " + referenceKey;
        } else {
            msg += "\n-> " + referenceKey;
        }
    }

    String[] lines = msg.split("(\r\n)|(\r)|(\n)");

    for (int i = 0; i < lines.length; i++) {
        String line = indent + lines[i].trim();

        if (i == lines.length - 1
                && (showErrors || (summary.getException() instanceof InternalErrorException))) {
            logger.error(line, summary.getException());
        } else {
            logger.error(line);
        }
    }

    indent += "  ";

    for (ExceptionSummary child : summary.getChildren()) {
        logSummary(child, references, indent, showErrors);
    }
}