public String get_snippet(int indent, int max_length) { return _source.get_snippet(indent, max_length); }
public String get_snippet() { return get_snippet(4, 75); }
public String get_snippet() { return _source.get_snippet(); }
public String get_snippet() { return _source.get_snippet(); }
public String get_snippet(int indent, int max_length) { return _source.get_snippet(indent, max_length); }
@Override public String toString() { String snippet = get_snippet(); StringBuilder builder = new StringBuilder(" in "); builder.append(name); builder.append(", line "); builder.append(line + 1); builder.append(", column "); builder.append(column + 1); builder.append(":\n"); builder.append(snippet); return builder.toString(); }
public String get_snippet() { return _source.get_snippet(); }
public String get_snippet(int indent, int max_length) { return _source.get_snippet(indent, max_length); }
public String get_snippet() { return _source.get_snippet(); }
public String get_snippet() { return get_snippet(4, 75); }
public String get_snippet() { return get_snippet(4, 75); }
public String get_snippet(int indent, int max_length) { return _source.get_snippet(indent, max_length); }
public String get_snippet() { return get_snippet(4, 75); }
@Override public String toString() { String snippet = get_snippet(); StringBuilder builder = new StringBuilder(" in "); builder.append(name); builder.append(", line "); builder.append(line + 1); builder.append(", column "); builder.append(column + 1); builder.append(":\n"); builder.append(snippet); return builder.toString(); }
@Override public String toString() { String snippet = get_snippet(); StringBuilder where = new StringBuilder(" in "); where.append(name); where.append(", line "); where.append(line + 1); where.append(", column "); where.append(column + 1); if (snippet != null) { where.append(":\n"); where.append(snippet); } return where.toString(); }
@Override public String toString() { String snippet = get_snippet(); StringBuilder where = new StringBuilder(" in "); where.append(name); where.append(", line "); where.append(line + 1); where.append(", column "); where.append(column + 1); if (snippet != null) { where.append(":\n"); where.append(snippet); } return where.toString(); }
private static String formatYamlExceptionMessage(Resource res, YAMLException ye) { final StringBuilder sb = new StringBuilder(); sb.append("YAML parsing error in ").append(res); if (ye instanceof MarkedYAMLException) { final Mark mark = ((MarkedYAMLException) ye).getProblemMark(); final String snippet = mark != null ? mark.get_snippet() : null; final String problem = ((MarkedYAMLException) ye).getProblem(); if (mark != null) { sb.append(" at line ").append(mark.getLine()).append(", column ").append(mark.getColumn()); } if (snippet != null) { sb.append(":\n"); sb.append(snippet); } if (problem != null) { // TODO SnakeYaml tends to be a bit nasty about this "problem", e.g org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens() prints the actual char THEN it's representation, so you end up with a big fat actual tab in the message instead of JUST \t(TAB) // See https://code.google.com/p/snakeyaml/issues/detail?id=209 sb.append(": ").append(problem.replaceAll("\\s*\\t\\s*", " ")); } } else { sb.append(": ").append(ye.getMessage()); } return sb.toString(); } }
public MarkedYAMLException apply(MarkedYAMLException e, String yaml) throws IOException { Mark problemMark = e.getProblemMark(); Optional<YamlLine> prevLine = getLine(yaml, problemMark.getLine() - 1); Optional<YamlLine> line = getLine(problemMark.get_snippet(0, 100), 0); if (prevLine.isPresent() && line.isPresent()) { YamlLine prev = prevLine.get(); YamlLine current = line.get(); if (isIncorrectIndentation(prev, current)) { return incorrectIndentationException(prev, current, e); } else if (isItemOutsideSequence(prev, current)) { return itemOutsideSequence(e); } } return new YamlSyntaxErrorException(e.getMessage(), e); }