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.aceevo.ursus.config.UrsusConfigurationFactory.java

private T validate(T ursusHttpServerConfig) {
    Set<ConstraintViolation<T>> violationSet = validator.validate(ursusHttpServerConfig);
    if (!violationSet.isEmpty()) {
        StringBuilder stringBuilder = new StringBuilder();
        for (ConstraintViolation constraintViolation : violationSet) {
            stringBuilder.append(constraintViolation.getPropertyPath());
            stringBuilder.append(" ");
            stringBuilder.append(constraintViolation.getMessage());
            stringBuilder.append(System.lineSeparator());
        }/* w  w w  .ja v a 2s  .  c o  m*/
        throw new RuntimeException(stringBuilder.substring(0, stringBuilder.length() - 1));
    }

    return ursusHttpServerConfig;
}

From source file:org.smigo.plants.Plant.java

@Override
public String toString() {
    return "Plant{" + "id=" + id + ", x=" + x + ", y=" + y + ", year=" + year + ", speciesId=" + speciesId
            + ", userId=" + userId + ", varietyId=" + varietyId + '}' + System.lineSeparator();
}

From source file:com.synopsys.integration.test.tool.TestLogger.java

public String getErrorOutputString() {
    if (errorList == null || errorList.isEmpty()) {
        return "";
    }//w  w w  .  j av  a 2 s.  com

    final List<String> stackTraces = new ArrayList<>();
    for (final Throwable e : errorList) {
        final StringWriter stringWriter = new StringWriter();
        e.printStackTrace(new PrintWriter(stringWriter));
        stackTraces.add(stringWriter.toString());
    }

    return StringUtils.join(stackTraces, System.lineSeparator());
}

From source file:com.mycompany.cassandrajavaclient.XmlParser.java

public void read(String filename) throws IOException {
    try (BufferedReader br = new BufferedReader(new FileReader(filename))) {
        StringBuilder sb = new StringBuilder();
        String line = br.readLine();
        while (line != null) {
            if (line.contains("<?xml")) {
                if (sb.length() > 0) {
                    parse(sb.toString());
                    sb.setLength(0);/*  w ww .  ja  v  a  2  s .  co  m*/
                }
            }
            sb.append(line);
            sb.append(System.lineSeparator());
            line = br.readLine();
        }

        if (sb.length() > 0) {
            parse(sb.toString());
        }
    }
}

From source file:com.sdfl.compiler.util.CompilerFileAndFolderUtilImpl.java

@Override
public void appendAtTheEndOfFile(File pFileToWrite, String pLine) {
    try {/*from  w w  w. j  a  v  a2 s  .com*/
        FileUtils.writeStringToFile(pFileToWrite, pLine + System.lineSeparator(), true);
    } catch (IOException e) {
        throw new CannotWriteToFileException(pFileToWrite, pLine);
    }
}

From source file:io.knotx.launcher.KnotxStarterVerticle.java

private Observable.Transformer<Pair<String, String>, String> joinDeployments() {
    return observable -> observable
            .reduce(new StringBuilder(System.lineSeparator()).append(System.lineSeparator()),
                    this::collectDeployment)
            .map(StringBuilder::toString);
}

From source file:org.smigo.user.authentication.RestAuthenticationFailureHandler.java

@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException exception) throws IOException, ServletException {
    response.setStatus(HttpStatus.FORBIDDEN.value());
    List<ObjectError> errors = new ArrayList<ObjectError>();
    if (exception instanceof BadCredentialsException) {
        errors.add(new ObjectError("bad-credentials", "msg.badcredentials"));
    } else {/*from w ww.j  a v  a 2 s .c  om*/
        errors.add(new ObjectError("username", "msg.unknownerror"));
    }
    String responseBody = objectMapper.writeValueAsString(errors);
    response.getWriter().append(responseBody);

    final String username = Arrays.toString(request.getParameterMap().get("username"));
    final String note = "Authentication Failure:" + username + System.lineSeparator() + exception;
    log.info(note);
    mailHandler.sendAdminNotification("authentication failure", note);
}

From source file:joanakeyrefactoring.javaforkeycreator.JavaProjectCopyHandler.java

public void addClassToTest(List<String> classContent, StaticCGJavaClass javaClass)
        throws FileNotFoundException, IOException {
    String relPathForJavaClass = getRelPathForJavaClass(javaClass);
    String className = javaClass.getOnlyClassName();
    File relPathFile = new File(pathToNew + "/" + relPathForJavaClass);
    relPathFile.mkdirs();//from w w w  .j  a  va  2  s  .  c o  m
    File javaFile = new File(pathToNew + relPathForJavaClass + "/" + className + ".java");
    javaFile.createNewFile();
    String classFileAsOneString = "";
    for (String l : classContent) {
        classFileAsOneString += l + System.lineSeparator();
    }
    PrintWriter out = new PrintWriter(javaFile);
    out.print(classFileAsOneString);
    out.close();
}

From source file:android.databinding.tool.store.Location.java

public Location(Token start, Token end) {
    if (start == null) {
        startLine = startOffset = NaN;// www . java  2s  .c  o m
    } else {
        startLine = start.getLine() - 1; //token lines start from 1
        startOffset = start.getCharPositionInLine();
    }

    if (end == null) {
        endLine = endOffset = NaN;
    } else {
        endLine = end.getLine() - 1; // token lines start from 1
        String endText = end.getText();
        int lastLineStart = endText.lastIndexOf(System.lineSeparator());
        String lastLine = lastLineStart < 0 ? endText : endText.substring(lastLineStart + 1);
        endOffset = end.getCharPositionInLine() + lastLine.length() - 1;//end is inclusive
    }
}

From source file:com.glluch.profilesparser.Writer.java

/**
 * Given a lists of code of competences, makes the piece of xml to write it.
 * @param ecfs A list of ECFMaps, all the competences levels in the profile.
 * @return An xml string which is the part representing the competences levels. 
 *//* w  ww.j  ava2 s  .  c  om*/
protected String competences2xml(ArrayList<ECFMap> ecfs) {
    //competence_
    String res = "";
    for (ECFMap ecf : ecfs) {
        res += "<field name=\"competence_\" >" + ecf.getCode() + " " + ecf.getLevel() + "</field>"
                + System.lineSeparator();
    }
    return res;
}