-
Notifications
You must be signed in to change notification settings - Fork 199
Added 'addUrl' method #727
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tcttk thanks for the contribution
-
Can you please explain how this change relates to custom providers?
-
And as I mentioned in Unable to create custom provider using yaml file when bundled as a jar. #714 before fixing it please provide a reproducible test case first
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #727 +/- ##
============================================
- Coverage 92.88% 92.78% -0.11%
- Complexity 2583 2585 +2
============================================
Files 281 281
Lines 5114 5126 +12
Branches 528 530 +2
============================================
+ Hits 4750 4756 +6
- Misses 236 240 +4
- Partials 128 130 +2
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks for this PR. Interesting to use a URL for this, how does this work? I expected something like an InputStream or so. |
hi @bodiam @snuyanzin, With this change, we can now add yaml files for the custom providers not only from the path, but also from the url. By giving a valid url parameter, it will get a stream from which you read the contents of the yaml and add to the map. I coded this fix because I encountered the problem as described in #714. Path class throws an exception when trying to stream files from external libraries, URL class does not.
|
@tcttk thanks for the explanation
it should work. Regarding changes I'm still a bit skeptic about: there is no any test confirming that it works. |
In the example you gave, I think the yaml file is in the project. What I'm talking about is this occurs when the yaml file is in a different jar. The error I get when I test the case above is You can check out the code block here. |
ok i see... loading files from other jars looks strange for me...
to fix it the condition could be tuned like if (path == null || Files.isDirectory(path)) {
throw new IllegalArgumentException("Path should be an existing file");
} and no need for a new methods and so on. |
After changing condition, the code here started to give the error below.
That's why I added a new method with url parameter. |
Can you share the code giving an error? I tested the code from #714 (comment) and it works ok |
I made the following edits.
Then try to get the yaml file from an external jar you depend on as you mentioned here. |
and what it is the trace in case it is failing? |
I realize that this case is difficult to test. I will write the things to do to test it in order.
|
Thanks for your explanation @tcttk |
Hey @snuyanzin, Which version are you planning to deploy with? |
Great, thanks for checking. About version, i guess it should be something like 2.x |
--------- Co-authored-by: Sergey Nuyanzin <snuyanzin@gmail.com>
--------- Co-authored-by: Sergey Nuyanzin <snuyanzin@gmail.com>
--------- Co-authored-by: Sergey Nuyanzin <snuyanzin@gmail.com>
fixes #714