ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
java.lang.VerifyError: org/ho/yaml/ReflectionUtil
at org.ho.yaml.JYamlParserEvent.<init>(Unknown Source)
at org.ho.yaml.YamlDecoder.readObjectOfType(Unknown Source)
at org.ho.yaml.YamlConfig.loadType(Unknown Source)
at org.ho.yaml.YamlConfig.loadType(Unknown Source)
at org.ho.yaml.Yaml.loadType(Unknown Source)
at com.eisoo.content.locator.ElementLocator.getLocatorMapFromYamlFile(ElementLocator.java:34)
As no one else has stepped up I will try to offer some direction...
First, your question appears to include an error message, but does not include the section of the file which is producing the error. It would be difficult for anyone to provide help without knowing what input is producing the error.
Next, I would suggest using your search engine of choice to look for similar problems and solutions already available, which is what I have had to do. Searching for "parse yaml with java" produces many useful looking hits. Looking over those results it appears to me that different parsers produce different results from the same yml input file - which makes finding an answer somewhat hit-or-miss.
jyaml is the original java yml parser implementation, but I see many references to the Jackson-yaml-module as a better, specifically more reliable alternative.
You can find reference information for many yaml parser implementations at Yaml.org, including jyaml which you are using.
If you still cannot find help, please post the file, or section of the file which produces the error, along with a more complete description of how you invoke the program and the complete error it produces.
Good luck!
Last edited by astrogeek; 01-25-2018 at 05:57 PM.
Reason: typos yml=yaml
I don't really know much about yaml or jyaml, but something to try would be to cut down even further to see which part causes problems, e.g., take out the quotes around "me", does just a bare
it is the jyaml.jar,in android platform,this jar can not be used
I have found a new jar :snakeyaml-1.18-android.jar
But I found that the code used to parse is not perfect:
Code:
private Map getLocatorMapFromYamlFile(String fileName) {
File yamlFile = new File("/sdcard/pagelocator/" + fileName + ".yaml");
Map locatorMap = null;
if(!yamlFile.exists() || !yamlFile.canRead())
return locatorMap;
try {
Yaml yaml = new Yaml();
locatorMap = (Map)yaml.load(new FileInputStream(yamlFile.getAbsolutePath()));
System.out.println("load yaml successfully");
} catch (Exception e) {
LogUtil.warn("WARNING: Fail to read yaml file: " + fileName + ".yaml");
}
return locatorMap;
}
public UiSelector getLocator(String key, ArrayList<String> locatorStringReplacement) {
UiSelector locatorBy = null;
if (_locatorMap == null)
return null;
String type[] = null;
String value[] = null;
if (_locatorMap.containsKey(key)) {
//get the value of the keyword
String indexValue = _locatorMap.get(key).toString();
//slice to type and value, index 0 is type and index 1 is value
String typeAndValue[] = indexValue.split(" ");
//slice type
type = typeAndValue[0].split(":");
//slice value
value = typeAndValue[1].split("value:");
if (type[1].equals("text") && null!=value[1])
locatorBy = new UiSelector().text(value[1]);
else if (type[1].equals("ctext"))
locatorBy = new UiSelector().textContains(value[1]);
else if (type[1].equals("stext"))
locatorBy = new UiSelector().textStartsWith(value[1]);
else if (type[1].equals("id"))
{ System.out.println(value[1]);
locatorBy = new UiSelector().resourceId(value[1]);}
else if (type[1].equals("classname"))
locatorBy = new UiSelector().className(value[1]);
else if (type[1].equals("desc"))
locatorBy = new UiSelector().description(value[1]);
else if (type[1].equals("sdesc"))
locatorBy = new UiSelector().descriptionStartsWith(value[1]);
else if (type[1].equals("cdesc"))
locatorBy = new UiSelector().descriptionContains(value[1]);
else{
LogUtil.error("The locator with specified name " + key + " does not exist.");
}
return locatorBy;
}
it is useful to my issue,but I think there should be other better methods
I did not construct a good data structure to parse:
I don't really know much about yaml or jyaml, but something to try would be to cut down even further to see which part causes problems, e.g., take out the quotes around "me", does just a bare
Code:
tap:me
work?
In fact the "me" is working for my program, of course ,take out the quotes around "me" is also working,it is not the root cause
As no one else has stepped up I will try to offer some direction...
First, your question appears to include an error message, but does not include the section of the file which is producing the error. It would be difficult for anyone to provide help without knowing what input is producing the error.
Next, I would suggest using your search engine of choice to look for similar problems and solutions already available, which is what I have had to do. Searching for "parse yaml with java" produces many useful looking hits. Looking over those results it appears to me that different parsers produce different results from the same yml input file - which makes finding an answer somewhat hit-or-miss.
jyaml is the original java yml parser implementation, but I see many references to the Jackson-yaml-module as a better, specifically more reliable alternative.
You can find reference information for many yaml parser implementations at Yaml.org, including jyaml which you are using.
If you still cannot find help, please post the file, or section of the file which produces the error, along with a more complete description of how you invoke the program and the complete error it produces.
Good luck!
I have suffered this issue for three days and search on google and tried many methods,but did not found the root cause
in the end , a developer told me that the jar can not be used on android.........
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.