Codota Logo
YAMLException
Code IndexAdd Codota to your IDE (free)

How to use
YAMLException
in
org.yaml.snakeyaml.error

Best Java code snippets using org.yaml.snakeyaml.error.YAMLException (Showing top 20 results out of 315)

Refine searchRefine arrow

  • Node
  • Constructor
  • Common ways to obtain YAMLException
private void myMethod () {
YAMLException y =
  • Codota IconThrowable cause;new YAMLException(cause)
  • Codota IconString str;new YAMLException(str)
  • Codota Iconnew YAMLException("Indent must be at most " + Emitter.MAX_INDENT)
  • Smart code suggestions by Codota
}
origin: redisson/redisson

@SuppressWarnings("unchecked")
public Object construct(Node node) {
  SequenceNode snode = (SequenceNode) node;
  if (Set.class.isAssignableFrom(node.getType())) {
    if (node.isTwoStepsConstruction()) {
      throw new YAMLException("Set cannot be recursive.");
    } else {
      return constructSet(snode);
  } else if (Collection.class.isAssignableFrom(node.getType())) {
    if (node.isTwoStepsConstruction()) {
      return newList(snode);
    } else {
      return constructSequence(snode);
  } else if (node.getType().isArray()) {
          return c.newInstance(argumentList);
        } catch (Exception e) {
          throw new YAMLException(e);
            return c.newInstance(argumentList.toArray());
          } catch (Exception e) {
            throw new YAMLException(e);
    throw new YAMLException(
        "No suitable constructor with " + String.valueOf(snode.getValue().size())
            + " arguments found for " + node.getType());
origin: redisson/redisson

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

protected Object constructJavaBean2ndStep(MappingNode node, Object object) {
  flattenMapping(node);
  Class<? extends Object> beanType = node.getType();
  List<NodeTuple> nodeValue = node.getValue();
      throw new YAMLException(
          "Keys must be scalars but found: " + tuple.getKeyNode());
    String key = (String) constructObject(keyNode);
    try {
      TypeDescription memberDescription = typeDefinitions.get(beanType);
        throw new YAMLException("No writable property '" + key + "' on class: "
            + beanType.getName());
      valueNode.setType(property.getType());
      final boolean typeDetected = (memberDescription != null)
          ? memberDescription.setupPropertyType(key, valueNode)
          : false;
      if (!typeDetected && valueNode.getNodeId() != NodeId.scalar) {
          if (valueNode.getNodeId() == NodeId.sequence) {
            Class<?> t = arguments[0];
            SequenceNode snode = (SequenceNode) valueNode;
          : constructObject(valueNode);
origin: redisson/redisson

  /**
   * Fail with a reminder to provide the seconds step for a recursive
   * structure
   * 
   * @see org.yaml.snakeyaml.constructor.Construct#construct2ndStep(org.yaml.snakeyaml.nodes.Node,
   *      java.lang.Object)
   */
  public void construct2ndStep(Node node, Object data) {
    if (node.isTwoStepsConstruction()) {
      throw new IllegalStateException("Not Implemented in " + getClass().getName());
    } else {
      throw new YAMLException("Unexpected recursive structure for Node: " + node);
    }
  }
}
origin: pl.droidsonroids.yaml/snakeyaml

if (Properties.class.isAssignableFrom(node.getType())) {
  Properties properties = new Properties();
  if (!node.isTwoStepsConstruction()) {
    constructMapping2ndStep(mnode, properties);
  } else {
    throw new YAMLException("Properties must not be recursive.");
} else if (SortedMap.class.isAssignableFrom(node.getType())) {
  SortedMap<Object, Object> map = new TreeMap<Object, Object>();
  if (!node.isTwoStepsConstruction()) {
    constructMapping2ndStep(mnode, map);
} else if (Map.class.isAssignableFrom(node.getType())) {
  if (node.isTwoStepsConstruction()) {
    return createDefaultMap();
  } else {
    return constructMapping(mnode);
origin: com.sap.cloud.yaas.raml-parser/raml-parser

@Override
public Node resolve(Node node, ResourceLoader resourceLoader, NodeHandler nodeHandler)
{
  String className = ((ScalarNode) node).getValue();
  try
  {
    Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
    JAXBContext context = JAXBContext.newInstance(clazz);
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    context.generateSchema(new SchemaOutputResolver()
    {
      @Override
      public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException
      {
        StreamResult result = new StreamResult(baos);
        result.setSystemId("001");
        return result;
      }
    });
    String schema = baos.toString();
    return new ScalarNode(Tag.STR, schema, node.getStartMark(), node.getEndMark(), ((ScalarNode) node).getStyle());
  }
  catch (Exception e)
  {
    throw new YAMLException(e);
  }
}
origin: redisson/redisson

public void setIndicatorIndent(int indicatorIndent) {
  if (indicatorIndent < 0) {
    throw new YAMLException("Indicator indent must be non-negative.");
  }
  if (indicatorIndent > Emitter.MAX_INDENT - 1) {
    throw new YAMLException("Indicator indent must be at most Emitter.MAX_INDENT-1: " + (Emitter.MAX_INDENT - 1));
  }
  this.indicatorIndent = indicatorIndent;
}
origin: redisson/redisson

protected Class<?> getClassForNode(Node node) {
  Class<? extends Object> classForTag = typeTags.get(node.getTag());
  if (classForTag == null) {
    String name = node.getTag().getClassName();
    Class<?> cl;
    try {
      cl = getClassForName(name);
    } catch (ClassNotFoundException e) {
      throw new YAMLException("Class not found: " + name);
    }
    typeTags.put(node.getTag(), cl);
    return cl;
  } else {
    return classForTag;
  }
}
origin: google/cdep

@NotNull
public static CDepManifestYml convertStringToManifest(@NotNull String url, @NotNull String content) {
 Invariant.registerYamlFile(url);
 Yaml yaml = new Yaml(new Constructor(CDepManifestYml.class));
 CDepManifestYml manifest;
 byte[] bytes = content.getBytes(StandardCharsets.UTF_8);
 try {
  manifest = (CDepManifestYml) yaml.load(new ByteArrayInputStream(bytes));
  // Try to read current version
  if (manifest != null) {
   manifest.sourceVersion = CDepManifestYmlVersion.vlatest;
  }
 } catch (YAMLException e) {
  try {
   manifest = V3Reader.convertStringToManifest(content);
  } catch (YAMLException e2) {
   if (!tryCreateSensibleParseError(e, 0)) {
    // If older readers also couldn't read it then report the original exception.
    require(false, e.toString());
   }
   return new CDepManifestYml(EMPTY_COORDINATE);
  }
 }
 require(manifest != null, "Manifest was empty");
 assert manifest != null;
 manifest = new ConvertNullToDefaultRewriter().visitCDepManifestYml(manifest);
 Node nodes = yaml.compose(new InputStreamReader(new ByteArrayInputStream(bytes)));
 SnakeYmlUtils.mapAndRegisterNodes(url, manifest, nodes);
 return manifest;
}
origin: redisson/redisson

  @SuppressWarnings("unchecked")
  public void construct2ndStep(Node node, Object object) {
    SequenceNode snode = (SequenceNode) node;
    if (List.class.isAssignableFrom(node.getType())) {
      List<Object> list = (List<Object>) object;
      constructSequenceStep2(snode, list);
    } else if (node.getType().isArray()) {
      constructArrayStep2(snode, object);
    } else {
      throw new YAMLException("Immutable objects cannot be recursive.");
    }
  }
}
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: redisson/redisson

for (Node child : node.getValue()) {
  if (child.getType() == Object.class) {
    child.setType(componentType);
      throw new YAMLException("unexpected primitive type");
origin: com.sap.cloud.yaas.raml-parser/raml-parser

if (root != null && root.getNodeId() == mapping)
errorMessage.add(createErrorResult(ex.getMessage()));
origin: redisson/redisson

protected Object newInstance(Class<?> ancestor, Node node, boolean tryDefault)
    throws InstantiationException {
  final Class<? extends Object> type = node.getType();
  if (typeDefinitions.containsKey(type)) {
    TypeDescription td = typeDefinitions.get(type);
    final Object instance = td.newInstance(node);
    if (instance != null) {
      return instance;
    }
  }
  if (tryDefault) {
    /*
     * Removed <code> have InstantiationException in case of abstract
     * type
     */
    if (ancestor.isAssignableFrom(type) && !Modifier.isAbstract(type.getModifiers())) {
      try {
        java.lang.reflect.Constructor<?> c = type.getDeclaredConstructor();
        c.setAccessible(true);
        return c.newInstance();
      } catch (NoSuchMethodException e) {
        throw new InstantiationException("NoSuchMethodException:"
            + e.getLocalizedMessage());
      } catch (Exception e) {
        throw new YAMLException(e);
      }
    }
  }
  throw new InstantiationException();
}
origin: com.sap.cloud.yaas.raml-parser/raml-parser

public static void dumpFromAst(Node rootNode, Writer output)
{
  if (rootNode == null)
  {
    throw new IllegalArgumentException("rootNode is null");
  }
  DumperOptions dumperOptions = new DumperOptions();
  //HYBRIS start - replaced null param with rootTag
  Tag rootTag = rootNode.getTag();
  Serializer serializer = new Serializer(new Emitter(output, dumperOptions), new Resolver(), dumperOptions,
      rootTag);
  //HYBRIS end
  
  try
  {
    serializer.open();
    serializer.serialize(rootNode);
    serializer.close();
  }
  catch (IOException e)
  {
    throw new YAMLException(e);
  }
}
origin: redisson/redisson

  return newInstance(type, node, false);
} catch (InstantiationException e1) {
  if (javaConstructor == null) {
    try {
      return newInstance(type, node, false);
    } catch (InstantiationException ie) {
      throw new YAMLException("No single argument constructor found for " + type
          + " : " + ie.getMessage());
    argument = constructScalar(node);
    try {
      javaConstructor = type.getDeclaredConstructor(String.class);
    } catch (Exception e) {
      throw new YAMLException("Can't construct a java object for scalar "
          + node.getTag() + "; No String constructor found. Exception="
          + e.getMessage(), e);
origin: pl.droidsonroids.yaml/snakeyaml

  throw new YAMLException("No single argument constructor found for " + type);
} else if (oneArgCount == 1) {
  argument = constructStandardJavaInstance(
  argument = constructScalar(node);
  try {
    javaConstructor = type.getDeclaredConstructor(String.class);
  } catch (Exception e) {
    throw new YAMLException("Can't construct a java object for scalar "
        + node.getTag() + "; No String constructor found. Exception="
        + e.getMessage(), e);
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: gov.nasa.jpl.imce/gov.nasa.jpl.magicdraw.projectUsageIntegrityChecker

ye.fillInStackTrace();
if (ProjectUsageIntegrityPlugin.getInstance().isShowAdvancedInformationProperty()) {
  final StringWriter sw = new StringWriter();
  final PrintWriter pw = new PrintWriter(sw);
  ye.printStackTrace(pw);
  buff.append(sw.toString());
origin: oyse/yedit

YEditLog.logger.info( "Encountered YAML syntax error:" + ex.toString() );
org.yaml.snakeyaml.errorYAMLException

Most used methods

  • <init>
  • getMessage
  • printStackTrace
  • toString
  • fillInStackTrace
  • getCause
  • getLocalizedMessage

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • findViewById (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now