gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 09:22:40 27 4
gpt4 key购买 nike

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

YAMLException.getMessage介绍

暂无

代码示例

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

public YAMLException(JsonParser p,
    org.yaml.snakeyaml.error.YAMLException src) {
  super(p, src.getMessage(), src);
}

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

public YAMLException(JsonParser p,
    org.yaml.snakeyaml.error.YAMLException src) {
  super(p, src.getMessage(), src);
}

代码示例来源:origin: sleekbyte/tailor

/**
 * Handle YAML related exceptions by printing out appropriate error message and exiting.
 */
public static void handleYAMLException(YAMLException exception) {
  System.err.println("Error parsing .tailor.yml:");
  System.err.println(exception.getMessage());
  System.exit(ExitCode.failure());
}

代码示例来源:origin: jphp-group/jphp

@Override
@Signature
public Memory format(Environment env, Memory... args) {
  try {
    return StringMemory.valueOf(yaml.dump(Memory.unwrap(env, args[0], true)));
  } catch (YAMLException e) {
    env.exception(ProcessorException.class, e.getMessage());
    return Memory.NULL;
  }
}

代码示例来源:origin: jphp-group/jphp

@Override
  @Signature
  public Memory formatTo(Environment env, Memory... args) {
    try {
      yaml.dump(
          Memory.unwrap(env, args[0], true),
          new OutputStreamWriter(Stream.getOutputStream(env, args[1]), env.getDefaultCharset())
      );

      return Memory.NULL;
    } catch (YAMLException e) {
      env.exception(ProcessorException.class, e.getMessage());
      return Memory.NULL;
    }
  }
}

代码示例来源:origin: jphp-group/jphp

@Override
@Signature
public Memory parse(Environment env, Memory... args) {
  try {
    if (args[0].instanceOf(Stream.class)) {
      return Memory.wrap(env, yaml.load(Stream.getInputStream(env, args[0])));
    } else {
      return Memory.wrap(env, yaml.load(args[0].toString()));
    }
  } catch (YAMLException e) {
    env.exception(ProcessorException.class, e.getMessage());
    return Memory.NULL;
  }
}

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

public YAMLException(JsonParser p,
    org.yaml.snakeyaml.error.YAMLException src) {
  super(p, src.getMessage(), src);
}

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

public YAMLException(JsonParser p,
    org.yaml.snakeyaml.error.YAMLException src) {
  super(p, src.getMessage(), src);
}

代码示例来源: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: QSFT/Doradus

logger.warn(e.getMessage() + " -- Ignoring.");
} catch (YAMLException e) {
  logger.warn(e.getMessage() + " -- Ignoring.");

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public Config loadConfig(URL url) throws ConfigurationException
{
  try
  {
    logger.debug("Loading settings from {}", url);
    byte[] configBytes;
    try (InputStream is = url.openStream())
    {
      configBytes = ByteStreams.toByteArray(is);
    }
    catch (IOException e)
    {
      // getStorageConfigURL should have ruled this out
      throw new AssertionError(e);
    }
    Constructor constructor = new CustomConstructor(Config.class);
    PropertiesChecker propertiesChecker = new PropertiesChecker();
    constructor.setPropertyUtils(propertiesChecker);
    Yaml yaml = new Yaml(constructor);
    Config result = loadConfig(yaml, configBytes);
    propertiesChecker.check();
    return result;
  }
  catch (YAMLException e)
  {
    throw new ConfigurationException("Invalid yaml: " + url + SystemUtils.LINE_SEPARATOR
                     +  " Error: " + e.getMessage(), false);
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public Config loadConfig(URL url) throws ConfigurationException
{
  try
  {
    logger.debug("Loading settings from {}", url);
    byte[] configBytes;
    try (InputStream is = url.openStream())
    {
      configBytes = ByteStreams.toByteArray(is);
    }
    catch (IOException e)
    {
      // getStorageConfigURL should have ruled this out
      throw new AssertionError(e);
    }
    Constructor constructor = new CustomConstructor(Config.class);
    PropertiesChecker propertiesChecker = new PropertiesChecker();
    constructor.setPropertyUtils(propertiesChecker);
    Yaml yaml = new Yaml(constructor);
    Config result = loadConfig(yaml, configBytes);
    propertiesChecker.check();
    return result;
  }
  catch (YAMLException e)
  {
    throw new ConfigurationException("Invalid yaml: " + url + SystemUtils.LINE_SEPARATOR
                     +  " Error: " + e.getMessage(), false);
  }
}

代码示例来源:origin: google/cdep

private static boolean tryCreateSensibleParseError(YAMLException e, int depth) {
 if (depth > 20) {
  return false;
 }
 if (e != null) {
  if (e.getCause() == null) {
   if (e.getMessage().contains("Unable to find property 'lib'")) {
    require(false, "Could not parse manifest. " +
      "The field 'lib' could not be created. Should it be 'libs'?");
    return true;
   }
  } else {
   return tryCreateSensibleParseError((YAMLException) e.getCause(), depth + 1);
  }
 }
 return false;
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public Config loadConfig(URL url) throws ConfigurationException
{
  try
  {
    logger.debug("Loading settings from {}", url);
    byte[] configBytes;
    try (InputStream is = url.openStream())
    {
      configBytes = ByteStreams.toByteArray(is);
    }
    catch (IOException e)
    {
      // getStorageConfigURL should have ruled this out
      throw new AssertionError(e);
    }
    Constructor constructor = new CustomConstructor(Config.class);
    PropertiesChecker propertiesChecker = new PropertiesChecker();
    constructor.setPropertyUtils(propertiesChecker);
    Yaml yaml = new Yaml(constructor);
    Config result = loadConfig(yaml, configBytes);
    propertiesChecker.check();
    return result;
  }
  catch (YAMLException e)
  {
    throw new ConfigurationException("Invalid yaml: " + url + SystemUtils.LINE_SEPARATOR
                     +  " Error: " + e.getMessage(), false);
  }
}

代码示例来源:origin: com.dell.doradus/doradus-server

logger.warn(e.getMessage() + " -- Ignoring.");
} catch (YAMLException e) {
  logger.warn(e.getMessage() + " -- Ignoring.");

代码示例来源:origin: jsevellec/cassandra-unit

public Config loadConfig(URL url) throws ConfigurationException
{
  try
  {
    logger.debug("Loading settings from {}", url);
    byte[] configBytes;
    try (InputStream is = url.openStream())
    {
      configBytes = ByteStreams.toByteArray(is);
    }
    catch (IOException e)
    {
      // getStorageConfigURL should have ruled this out
      throw new AssertionError(e);
    }
    Constructor constructor = new CustomConstructor(Config.class);
    PropertiesChecker propertiesChecker = new PropertiesChecker();
    constructor.setPropertyUtils(propertiesChecker);
    Yaml yaml = new Yaml(constructor);
    Config result = loadConfig(yaml, configBytes);
    propertiesChecker.check();
    return result;
  }
  catch (YAMLException e)
  {
    throw new ConfigurationException("Invalid yaml: " + url + SystemUtils.LINE_SEPARATOR
                     +  " Error: " + e.getMessage(), false);
  }
}

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

errorMessage.add(createErrorResult(ex.getMessage()));

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

errorMessage.add(createErrorResult(ex.getMessage()));

代码示例来源:origin: org.onehippo.cms/hippo-configuration-management-model

throw new ParserException("YAML parse exception: " + e.getMessage(), node, e);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com