Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/call single in karate basejs from classpath #1317

Conversation

joelpramos
Copy link
Contributor

Description

Thanks for contributing this Pull Request. Make sure that you submit this Pull Request against the develop branch of this repository, add a brief description, and tag the relevant issue(s) and PR(s) below.

…ith loading files from Spring Boot classpath. Making Nashorn lazy-init and synchronized to avoid parallel() test execution concurrency issues (keeping function to allow external override).
@ptrthomas ptrthomas merged commit 075beaa into karatelabs:develop Oct 12, 2020
ptrthomas added a commit that referenced this pull request Oct 12, 2020
@ptrthomas
Copy link
Member

I merged this. also did a little more refactoring of Resource (just one constructor flow) and FileUtils

one request - can we avoid these 2 lines:

ClassLoader cl = this.classLoader != null ? this.classLoader : Resource.class.getClassLoader();
InputStream tempStream = cl.getResourceAsStream(relativePath.replace(FileUtils.CLASSPATH_COLON, ""));

if I'm not mistaken, the classLoader will never be null. also, the Path should always be a valid one. I hope that Files.newInputStream(path) should be sufficient. I also feel the classLoader does not need to kept in the Resource but maybe it can be useful in the future

@ptrthomas
Copy link
Member

ptrthomas commented Oct 12, 2020

and just FYI - I just came across this: https://github.com/classgraph/classgraph

since this area has been so painful - and considering who knows what issues that Java 9 modules / jigsaw will bring - maybe we should just use this. wonder what you think @joelpramos

@joelpramos
Copy link
Contributor Author

@ptrthomas for the first question - Files.newInputStream(path) is exactly where my problem with Spring Boot was. I left the null checks for classloader because I was only able to test in Windows (packaged JAR and via IntelliJ) and docker but couldn't test with other CI/CD tools / Mac.

Classgraph seems interesting ... I read through it and will probably be best to use to avoid such problems in the future as there might be other problems with other frameworks. I'll try to set it up during this week.

@ptrthomas
Copy link
Member

@joelpramos

Files.newInputStream(path) is exactly where my problem with Spring Boot was.

ah ok, then fine - if it works it works. yes do look at Classgraph when you get time - an extra JAR dep is worth it

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants