praveen1503 / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 0 forks source link

MockClassLoader.getResources loads twice same file #426

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Execute attached file.

What is the expected output? What do you see instead?
1. Only one resource found.

What version of the product are you using? On what operating system?
powermock-mockito-1.5-full, Win7 x64.

Please provide any additional information below.
The method getResources, inherited from ClassLoader, delegates the search of 
resources to parent ClassLoader and then try to find it in his own ClassLoader. 
This way, the resource is found in the parent ClassLoader when the behaviour of 
MockClassLoader should delegate this function to the wrapped ClassLoader, which 
could be the same parent, causing to load the file twice.

Original issue reported on code.google.com by ande.brb on 29 Jan 2013 at 11:52

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for reporting. Could you please help out and provide a patch for this?

Original comment by johan.ha...@gmail.com on 2 Feb 2013 at 11:06

GoogleCodeExporter commented 8 years ago
I found this after posting on StackOverflow: 
http://stackoverflow.com/questions/21885178/mixing-powermock-with-weld/21902645#
21902645

Attached is a patch that fixes it.

Original comment by kelsey0...@gmail.com on 20 Feb 2014 at 1:00

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks, I've committed it to trunk now.

Original comment by johan.ha...@gmail.com on 21 Feb 2014 at 6:32