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

Rename data resource for bundle to avoid collisions #264

Closed
DeGuitard opened this issue Aug 21, 2017 · 2 comments
Closed

Rename data resource for bundle to avoid collisions #264

DeGuitard opened this issue Aug 21, 2017 · 2 comments
Milestone

Comments

@DeGuitard
Copy link

Hello,

I enjoy a lot using this lib and tends to get it on all projects I work on. However I stumbled on a project with wich I can't get random-beans to work.

I'm using random-beans 3.7.0.

The error I get is:

java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key urls
	at java.util.ResourceBundle.getObject(ResourceBundle.java:450)
	at java.util.ResourceBundle.getString(ResourceBundle.java:407)
	at io.github.benas.randombeans.randomizers.AbstractRandomizer.getPredefinedValuesOf(AbstractRandomizer.java:50)
	at io.github.benas.randombeans.randomizers.net.UrlRandomizer.<init>(UrlRandomizer.java:38)
	at io.github.benas.randombeans.randomizers.registry.InternalRandomizerRegistry.init(InternalRandomizerRegistry.java:102)
	at io.github.benas.randombeans.EnhancedRandomBuilder.lambda$setupRandomizerRegistries$5(EnhancedRandomBuilder.java:448)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at io.github.benas.randombeans.EnhancedRandomBuilder.setupRandomizerRegistries(EnhancedRandomBuilder.java:448)
	at io.github.benas.randombeans.EnhancedRandomBuilder.build(EnhancedRandomBuilder.java:432)
	at com.lyra.vads.offline.data.boleto.row.TransacaoBradescoCNAB400Test.before(TransacaoBradescoCNAB400Test.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	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:678)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

And the cause is fairly simple, this project already has a data.properties file loaded. So the getBundle("data") doesn't return the one from random-beans, and then fails to fetch the URLs list.

I guess the lib should use a less generic name for the bundle (maybe including the name of lib)?

fmbenhassine added a commit that referenced this issue Sep 7, 2017
…bundle_name

use more specific resource bundle name (fixes #264)
@fmbenhassine
Copy link
Member

Hi @DeGuitard

We've pushed a fix in 3.8.0-SNAPSHOT with a specific name for the resource bundle (random-beans-data.properties instead of data.properties).

Can you give it a try and tell us if this is ok for you?

Many thanks to @PascalSchumacher for the fix.

Kind regards
Mahmoud

@DeGuitard
Copy link
Author

Sure, I'm not at my place right now, I'll test it by the end of next week. Many thanks!

@fmbenhassine fmbenhassine added this to the v3.8.0 milestone Feb 12, 2018
@fmbenhassine fmbenhassine changed the title Can't find resource for bundle, because of name collision Rename data resource for bundle to avoid collisions Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants