Example usage for java.lang System lineSeparator

List of usage examples for java.lang System lineSeparator

Introduction

In this page you can find the example usage for java.lang System lineSeparator.

Prototype

String lineSeparator

To view the source code for java.lang System lineSeparator.

Click Source Link

Usage

From source file:com.norconex.jef4.status.JobSuiteStatusSnapshot.java

private void toString(StringBuilder b, String jobId, int depth) {
    IJobStatus status = getJobStatus(jobId);
    b.append(StringUtils.repeat(' ', depth * TO_STRING_INDENT));
    b.append(StringUtils.leftPad(new PercentFormatter().format(status.getProgress()), TO_STRING_INDENT));
    b.append("  ").append(status.getJobId());
    b.append(System.lineSeparator());
    for (IJobStatus child : getChildren(jobId)) {
        toString(b, child.getJobId(), depth + 1);
    }//from   ww  w .ja v a2s .  c o m
}

From source file:org.elasticsoftware.elasticactors.rabbitmq.cpt.RabbitMQMessagingService.java

@Override
public void onCreateFailure(final Throwable failure) {
    logger.error("Channel creation failed, reason: " + System.lineSeparator()
            + Throwables.getStackTraceAsString(failure));
}

From source file:io.cloudslang.lang.cli.SlangCli.java

private String printCompileErrors(List<RuntimeException> exceptions, File file, StringBuilder stringBuilder) {
    if (exceptions.size() > 0) {
        stringBuilder.append("Following exceptions were found:").append(System.lineSeparator());
        for (RuntimeException exception : exceptions) {
            stringBuilder.append("\t");
            stringBuilder.append(exception.getClass());
            stringBuilder.append(": ");
            stringBuilder.append(exception.getMessage());
            stringBuilder.append(System.lineSeparator());
        }//from  w  ww  . ja v a  2s.c o m
        throw new RuntimeException(stringBuilder.toString());
    } else {
        stringBuilder.append("Compilation was successful for ").append(file.getName());
    }
    return StringUtils.trim(stringBuilder.toString());
}

From source file:de.fosd.jdime.common.ASTNodeArtifact.java

/**
 * Returns the AST in dot-format.//from ww  w  . j  av a  2s.com
 *
 * @param includeNumbers
 *            include node number in label if true
 * @return AST in dot-format.
 */
public final String dumpGraphvizTree(final boolean includeNumbers) {
    assert (astnode != null);
    StringBuilder sb = new StringBuilder();
    sb.append(getNumber()).append("[label=\"");

    // node label
    if (includeNumbers) {
        sb.append("(").append(getNumber()).append(") ");
    }

    sb.append(astnode.dumpString());

    sb.append("\"");

    //      if (hasMatches()) {
    //         sb.append(", fillcolor = green, style = filled");
    //      }
    if (isConflict()) {
        // should not happen
        sb.append(", fillcolor = gray, style = filled");
    } else if (isAdded()) {
        sb.append(", fillcolor = yellow, style = filled");
    } else if (isDeleted()) {
        sb.append(", fillcolor = red, style = filled");
    }

    sb.append("];");
    sb.append(System.lineSeparator());

    // children
    for (ASTNodeArtifact child : getChildren()) {
        sb.append(child.dumpGraphvizTree(includeNumbers));

        // edge
        sb.append(getNumber()).append("->").append(child.getNumber()).append(";")
                .append(System.lineSeparator());
    }

    return sb.toString();
}

From source file:com.netflix.genie.web.jobs.workflow.impl.InitialSetupTask.java

@VisibleForTesting
void createCommandEnvironmentVariables(final Writer writer, final Command command) throws IOException {
    final String commandId = command.getId();
    writer.write(JobConstants.EXPORT + JobConstants.GENIE_COMMAND_DIR_ENV_VAR + JobConstants.EQUALS_SYMBOL
            + JobConstants.DOUBLE_QUOTE_SYMBOL + "${" + JobConstants.GENIE_JOB_DIR_ENV_VAR + "}"
            + JobConstants.FILE_PATH_DELIMITER + JobConstants.GENIE_PATH_VAR + JobConstants.FILE_PATH_DELIMITER
            + JobConstants.COMMAND_PATH_VAR + JobConstants.FILE_PATH_DELIMITER + commandId
            + JobConstants.DOUBLE_QUOTE_SYMBOL + LINE_SEPARATOR);

    // Append new line
    writer.write(LINE_SEPARATOR);/*from w  w  w .j a va  2 s  .  c o m*/

    writer.write(JobConstants.EXPORT + JobConstants.GENIE_COMMAND_ID_ENV_VAR + JobConstants.EQUALS_SYMBOL
            + JobConstants.DOUBLE_QUOTE_SYMBOL + commandId + JobConstants.DOUBLE_QUOTE_SYMBOL + LINE_SEPARATOR);

    // Append new line
    writer.write(System.lineSeparator());

    writer.write(JobConstants.EXPORT + JobConstants.GENIE_COMMAND_NAME_ENV_VAR + JobConstants.EQUALS_SYMBOL
            + JobConstants.DOUBLE_QUOTE_SYMBOL + command.getMetadata().getName()
            + JobConstants.DOUBLE_QUOTE_SYMBOL + LINE_SEPARATOR);

    // Append new line
    writer.write(System.lineSeparator());

    writer.write(JobConstants.EXPORT + JobConstants.GENIE_COMMAND_TAGS_ENV_VAR + JobConstants.EQUALS_SYMBOL
            + JobConstants.DOUBLE_QUOTE_SYMBOL + this.tagsToString(DtoConverters.toV3Tags(command.getId(),
                    command.getMetadata().getName(), command.getMetadata().getTags()))
            + JobConstants.DOUBLE_QUOTE_SYMBOL + LINE_SEPARATOR);

    // Append new line
    writer.write(System.lineSeparator());
}

From source file:net.di2e.ecdr.source.rest.AbstractCDRSource.java

protected SourceResponse doQuery(Map<String, String> filterParameters, QueryRequest queryRequest)
        throws UnsupportedQueryException {
    SourceResponse sourceResponse;//from w w  w  .  j  a v a  2 s .  c om
    setSecurityCredentials(cdrRestClient, queryRequest.getProperties());
    filterParameters.putAll(getInitialFilterParameters(queryRequest));
    setURLQueryString(filterParameters);
    LOGGER.debug("Executing http GET query to source [{}] with url [{}]", getId(),
            cdrRestClient.getCurrentURI().toString());
    Response response = cdrRestClient.get();
    LOGGER.debug("Query to source [{}] returned http status code [{}] and media type [{}]", getId(),
            response.getStatus(), response.getMediaType());

    if (response.getStatus() == Status.OK.getStatusCode()) {
        AtomResponseTransformer transformer = new AtomResponseTransformer(getFilterConfig());

        sourceResponse = transformer.processSearchResponse((InputStream) response.getEntity(), queryRequest,
                getId());
        sourceResponse = enhanceResults(sourceResponse);
    } else {
        Object entity = response.getEntity();
        if (entity != null) {
            try {
                LOGGER.warn("Error status code received [{}] when querying site [{}]:{}[{}]",
                        response.getStatus(), getId(), System.lineSeparator(),
                        IOUtils.toString((InputStream) entity));
            } catch (IOException e) {
                LOGGER.warn("Error status code received [{}] when querying site [{}]", response.getStatus(),
                        getId());
            }
        } else {
            LOGGER.warn("Error status code received [{}] when querying site [{}]", response.getStatus(),
                    getId());
        }
        throw new UnsupportedQueryException(
                "Query to remote source returned http status code " + response.getStatus());
    }
    return sourceResponse;
}

From source file:com.oneops.inductor.Listener.java

/**
 * set state file by thread id/*w w w.  j  a v  a  2s.co m*/
 */
private void setStateFile(CmsWorkOrderSimpleBase wo) {
    String filename = getStateFileName();
    String content = System.currentTimeMillis() + " " + wo.getClassName() + "::" + wo.getAction() + " "
            + wo.getNsPath() + System.lineSeparator();
    writeStateFile(filename, content);
}

From source file:org.apache.zeppelin.submarine.hadoop.YarnClient.java

public Map<String, Object> getClusterApps(String appId) {
    Map<String, Object> appAttempts = new HashMap<>();
    String appUrl = this.yarnWebHttpAddr + "/ws/v1/cluster/apps/" + appId + "?_=" + System.currentTimeMillis();

    InputStream inputStream = null;
    try {/*from   w  w  w. ja  v a2s .co m*/
        HttpResponse response = callRestUrl(appUrl, principal, HTTP.GET);
        inputStream = response.getEntity().getContent();
        String result = new BufferedReader(new InputStreamReader(inputStream)).lines()
                .collect(Collectors.joining(System.lineSeparator()));
        if (response.getStatusLine().getStatusCode() != 200 /*success*/) {
            LOGGER.warn("Status code " + response.getStatusLine().getStatusCode());
            LOGGER.warn("message is :" + Arrays.deepToString(response.getAllHeaders()));
            LOGGER.warn("result\n" + result);
        }
        // parse app status json
        appAttempts = parseClusterApps(result);

        return appAttempts;
    } catch (Exception exp) {
        exp.printStackTrace();
    } finally {
        try {
            if (null != inputStream) {
                inputStream.close();
            }
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
    }

    return appAttempts;
}

From source file:io.cloudslang.content.vmware.services.DeployOvfTemplateService.java

private void checkImportSpecResultForErrors(OvfCreateImportSpecResult importSpecResult) throws Exception {
    if (0 < importSpecResult.getError().size()) {
        StringBuilder stringBuilder = new StringBuilder();
        for (LocalizedMethodFault fault : importSpecResult.getError()) {
            stringBuilder.append(fault.getLocalizedMessage()).append(System.lineSeparator());
        }//from  ww  w .  j a v  a  2  s . c  om
        throw new Exception(stringBuilder.toString());
    }
}

From source file:com.pearson.eidetic.driver.threads.subthreads.SnapshotChecker.java

public String getPeriod(JSONObject eideticParameters, Volume vol) {
    if ((eideticParameters == null)) {
        return null;
    }/*from   w  w w.  j a va  2s .co  m*/
    JSONObject createSnapshot = null;
    if (eideticParameters.containsKey("CreateSnapshot")) {
        createSnapshot = (JSONObject) eideticParameters.get("CreateSnapshot");
    }
    if (createSnapshot == null) {
        logger.error("awsAccountNickname=\"" + uniqueAwsAccountIdentifier_
                + "\",Event=Error, Error=\"Malformed Eidetic Tag\", Volume_id=\"" + vol.getVolumeId() + "\"");
        return null;
    }

    String period = null;
    if (createSnapshot.containsKey("Interval")) {
        try {
            period = createSnapshot.get("Interval").toString();
        } catch (Exception e) {
            logger.error("awsAccountNickname=\"" + uniqueAwsAccountIdentifier_
                    + "\",Event=Error, Error=\"Malformed Eidetic Tag\", Volume_id=\"" + vol.getVolumeId()
                    + "\", stacktrace=\"" + e.toString() + System.lineSeparator()
                    + StackTrace.getStringFromStackTrace(e) + "\"");
        }
    }

    return period;
}