org.yaml.snakeyaml.error.MarkedYAMLException.getProblem()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中org.yaml.snakeyaml.error.MarkedYAMLException.getProblem()方法的一些代码示例,展示了MarkedYAMLException.getProblem()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MarkedYAMLException.getProblem()方法的具体详情如下:
包路径:org.yaml.snakeyaml.error.MarkedYAMLException
类名称:MarkedYAMLException
方法名:getProblem

MarkedYAMLException.getProblem介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

public String getProblem() {
  return _source.getProblem();
}

代码示例来源:origin: alien4cloud/alien4cloud

public ParsingError(ErrorCode errorCode, MarkedYAMLException cause) {
    this(ParsingErrorLevel.ERROR, errorCode, cause.getContext(), cause.getContextMark() != null ? cause.getContextMark() : cause.getProblemMark(),
        cause.getProblem(), cause.getProblemMark(), null);
  }
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

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();
  }
}

代码示例来源:origin: com.fasterxml.jackson.dataformat/jackson-dataformat-yaml

public String getProblem() {
  return _source.getProblem();
}

代码示例来源:origin: org.raml/raml-parser

errorMessage.add(createErrorResult(mye.getProblem(), mye.getProblemMark(), mye.getProblemMark()));

代码示例来源:origin: FasterXML/jackson-dataformat-yaml

public String getProblem() {
  return _source.getProblem();
}

代码示例来源:origin: com.sap.cloud.yaas.raml-parser/raml-parser

errorMessage.add(createErrorResult(mye.getProblem(), mye.getProblemMark(), mye.getProblemMark()));

代码示例来源:origin: harbby/presto-connectors

public String getProblem() {
  return _source.getProblem();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static void raiseParserException(ThreadContext context, IRubyObject yaml, MarkedYAMLException mye, IRubyObject rbPath) {
  Ruby runtime;
  Mark mark;
  RubyClass se;
  IRubyObject exception;
  runtime = context.runtime;
  se = (RubyClass)runtime.getModule("Psych").getConstant("SyntaxError");
  mark = mye.getProblemMark();
  exception = se.newInstance(context,
      new IRubyObject[] {
        rbPath,
        runtime.newFixnum(mark.getLine() + 1),
        runtime.newFixnum(mark.getColumn() + 1),
        runtime.newFixnum(mark.getIndex()),
        (null == mye.getProblem() ? runtime.getNil() : runtime.newString(mye.getProblem())),
        (null == mye.getContext() ? runtime.getNil() : runtime.newString(mye.getContext()))
      },
      Block.NULL_BLOCK);
  RubyKernel.raise(context, runtime.getKernel(), new IRubyObject[] { exception }, Block.NULL_BLOCK);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static void raiseParserException(ThreadContext context, IRubyObject yaml, MarkedYAMLException mye, IRubyObject rbPath) {
  Ruby runtime;
  Mark mark;
  RubyClass se;
  IRubyObject exception;
  runtime = context.runtime;
  se = (RubyClass)runtime.getModule("Psych").getConstant("SyntaxError");
  mark = mye.getProblemMark();
  exception = se.newInstance(context,
      new IRubyObject[] {
        rbPath,
        runtime.newFixnum(mark.getLine() + 1),
        runtime.newFixnum(mark.getColumn() + 1),
        runtime.newFixnum(mark.getIndex()),
        (null == mye.getProblem() ? runtime.getNil() : runtime.newString(mye.getProblem())),
        (null == mye.getContext() ? runtime.getNil() : runtime.newString(mye.getContext()))
      },
      Block.NULL_BLOCK);
  RubyKernel.raise(context, runtime.getKernel(), new IRubyObject[] { exception }, Block.NULL_BLOCK);
}

代码示例来源:origin: oyse/yedit

marker.setAttribute(IMarker.MESSAGE, ex.getProblem() );

相关文章