Search in sources :

Example 1 with InternalErrorException

use of org.apache.maven.InternalErrorException in project kie-wb-common by kiegroup.

the class AFMavenCli method logSummary.

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);
        }
    }
    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);
    }
}
Also used : ExceptionSummary(org.apache.maven.exception.ExceptionSummary) InternalErrorException(org.apache.maven.InternalErrorException)

Example 2 with InternalErrorException

use of org.apache.maven.InternalErrorException in project kie-wb-common by kiegroup.

the class ReusableAFMavenCli method logSummary.

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);
        }
    }
    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);
    }
}
Also used : ExceptionSummary(org.apache.maven.exception.ExceptionSummary) InternalErrorException(org.apache.maven.InternalErrorException)

Example 3 with InternalErrorException

use of org.apache.maven.InternalErrorException in project kie-wb-common by kiegroup.

the class AFMavenCli method logSummary.

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);
        }
    }
    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);
    }
}
Also used : ExceptionSummary(org.apache.maven.exception.ExceptionSummary) InternalErrorException(org.apache.maven.InternalErrorException)

Aggregations

InternalErrorException (org.apache.maven.InternalErrorException)3 ExceptionSummary (org.apache.maven.exception.ExceptionSummary)3