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

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

Introduction

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

Prototype

public String getReference() 

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);
        }//from ww w  .  j av a  2  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))) {
            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);
        }/* w ww  .  java  2 s. c  om*/
    }

    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);
        }//from  ww w .  ja v a 2s  .  co  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);
        }/*from w  w w.  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))) {
            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. java2s.  co  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()) {
        logSummary(child, references, indent, showErrors);
    }
}