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

Improve exception thrown by Source.fromResource #9054

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

nogurenn
Copy link
Contributor

Fixes scala/bug#11743

Improves the exception message a bit. Adds a basic method call test.

I unfortunately orphaned PR #8443. This is the replacement.

I need pointers about two things:

I want to write a test that (1) creates two classloader instances A & B each with its own resources path, then (2) call Source.fromResource('file_in_B.txt', classLoaderA). I wanted to test the case where it should throw the exception if the resource exists but not in the given resource path.

I'm trying MissingResourceException instead, but I don't know what to use to fill in the className and key arguments.

@scala-jenkins scala-jenkins added this to the 2.13.4 milestone Jun 13, 2020
@lrytz
Copy link
Member

lrytz commented Jun 15, 2020

LGTM as-is.

@nogurenn nogurenn marked this pull request as ready for review June 16, 2020 01:47
@SethTisue SethTisue modified the milestones: 2.13.4, 2.13.3 Jun 16, 2020
@SethTisue SethTisue merged commit 9371ef7 into scala:2.13.x Jun 16, 2020
@SethTisue
Copy link
Member

I agree with Lukas that the test you already added is sufficient.

Thank you!

@SethTisue SethTisue added the library:base Changes to the base library, i.e. Function Tuples Try label Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library:base Changes to the base library, i.e. Function Tuples Try
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source.fromResource("some_file") throws NPE instead of FileNotFound exception
4 participants