Giter Site home page Giter Site logo

package fails about uap-java HOT 9 CLOSED

ua-parser avatar ua-parser commented on August 22, 2024
package fails

from uap-java.

Comments (9)

bestage avatar bestage commented on August 22, 2024

Getting the same issue, would be good if you can fix it!

org.yaml.snakeyaml.error.YAMLException: java.io.IOException: Stream closed
at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:198)
at org.yaml.snakeyaml.reader.StreamReader.(StreamReader.java:62)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:411)
at ua_parser.Parser.initialize(Parser.java:69)
at ua_parser.Parser.(Parser.java:44)
at ua_parser.Parser.(Parser.java:40)
at ua_parser.TestTest.test(TestTest.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.io.IOException: Stream closed
at java.io.PushbackInputStream.ensureOpen(PushbackInputStream.java:57)
at java.io.PushbackInputStream.read(PushbackInputStream.java:149)
at org.yaml.snakeyaml.reader.UnicodeReader.init(UnicodeReader.java:88)
at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:118)
at java.io.Reader.read(Reader.java:123)
at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:182)
... 29 more

from uap-java.

bestage avatar bestage commented on August 22, 2024

Seems like the code is trying to load this file, which is not present in the project ,-)

private static final String REGEX_YAML_PATH = "/ua_parser/regexes.yaml";

from uap-java.

thyandrecardoso avatar thyandrecardoso commented on August 22, 2024

In the same directory where you have the uap-java repo, which you are trying to build, you need also to put this repo:

It contains resources uap-java is expecting to find.

from uap-java.

ameyamahajan avatar ameyamahajan commented on August 22, 2024

Directory structure:

find ./ua-parser/ -depth -2
./ua-parser/
./ua-parser//uap-core
./ua-parser//uap-java

I ran command from ./ua-parser/uap-java directory, mvn package. I failed for couple of entries

mvn package

Summary of mvn package

*It fails for
Failed tests: testCachedParseDevice(ua_parser.CachingParserTest): Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Amaze_4G Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30(..)

testParseDevice(ua_parser.CachingParserTest): Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Amaze_4G Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30(..)

testParseDevice(ua_parser.ParserTest): Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Amaze_4G Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30(..)*

from uap-java.

thyandrecardoso avatar thyandrecardoso commented on August 22, 2024

Yes, I'm having the same problems. It seems that the some of the different implementations are not up to date with the core, so some tests fail.

from uap-java.

ameyamahajan avatar ameyamahajan commented on August 22, 2024

I created a test class RunTest.java, it does not execute well

java RunTest
Exception in thread "main" java.lang.NoClassDefFoundError: org/yaml/snakeyaml/constructor/BaseConstructor
at RunTest.main(RunTest.java:10)
Caused by: java.lang.ClassNotFoundException: org.yaml.snakeyaml.constructor.BaseConstructor
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more

This class looks like

import ua_parser.Parser;
import ua_parser.Client;
class RunTest{
public static void main (String []args){
try{
String uaString = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3";
Parser uaParser = new Parser();
Client c = uaParser.parse(uaString);
System.out.println(c.userAgent.family); // => "Mobile Safari"
System.out.println(c.userAgent.major); // => "5"
System.out.println(c.userAgent.minor); // => "1"
System.out.println(c.os.family); // => "iOS"
System.out.println(c.os.major); // => "5"
System.out.println(c.os.minor); // => "1"
System.out.println(c.device.family); // => "iPhone"
}
catch(Exception ex){ex.printStackTrace();}
}
}

Disclaimer : I am new to maven tool.

from uap-java.

lefloh avatar lefloh commented on August 22, 2024

Tests are working with PR #7

from uap-java.

knut-forkalsrud avatar knut-forkalsrud commented on August 22, 2024

I noticed a commit by "commenthol" on Nov 5, 2014 tried to address the same, more or less.
That was reverted by "tobie" two days later, without further comment.

Now the regex file in ua-core has had the new formats for several months, and it seems this pull request is just waiting for someone to merge it. I'm not entirely sure who's the official maintainer here, the readme file only lists the initial author.

from uap-java.

staslos avatar staslos commented on August 22, 2024

Still the issue exists. Admins, please, merge [~lefloh] pull request

from uap-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.