You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The java.desktop is a quite huge dependency for a parser, please consider avoiding this dependency or parse the Yaml at compile time (this improves performances too).
java.lang.NoClassDefFoundError: java/beans/IntrospectionException
at org.yaml.snakeyaml.representer.BaseRepresenter.getPropertyUtils(BaseRepresenter.java:202)
at org.yaml.snakeyaml.Yaml.initDumperOptions(Yaml.java:120)
at org.yaml.snakeyaml.Yaml.<init>(Yaml.java:113)
at org.yaml.snakeyaml.Yaml.<init>(Yaml.java:103)
at ua_parser.Parser.initialize(Parser.java:80)
at ua_parser.Parser.<init>(Parser.java:45)
...
Caused by: java.lang.ClassNotFoundException: java.beans.IntrospectionException
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 19 common frames omitted
The new snakeyaml-engine loads regexes.yaml successfully and fixes this issue.
Here is a Kotlin POC
importorg.snakeyaml.engine.v2.api.Loadimportorg.snakeyaml.engine.v2.api.LoadSettingsimportua_parser.UserAgentParserfunmain() {
val load =Load(LoadSettings.builder().build())
val regexes =UserAgentParser::class.java.getResourceAsStream("/ua_parser/regexes.yaml")!!.use { stream ->
load.loadFromString(stream.reader().readText()) asMap<String, *>
}
println(regexes["user_agent_parsers"])
}
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
api 'org.snakeyaml:snakeyaml-engine:2.3'
api 'com.github.ua-parser:uap-java:1.5.2'
}
Activity
fvasco commentedon Dec 9, 2021
The new snakeyaml-engine loads
regexes.yamlsuccessfully and fixes this issue.Here is a Kotlin POC