Open GoogleCodeExporter opened 9 years ago
You can suppress the static initializer by using the
@SuppressStaticInitializerFor annotation. This is clearly mentioned in the
documentation
(http://code.google.com/p/powermock/wiki/SuppressUnwantedBehavior#Suppress_stati
c_initializer).
Original comment by johan.ha...@gmail.com
on 21 Oct 2011 at 6:20
Hi,
As I stated in this issue,I know I perhaps can suppress static initilizer. But
the problem is if I do need FOLDER to be initialized,not simply supressed? How
to do?
Original comment by smartmar...@gmail.com
on 21 Oct 2011 at 7:44
Ah sorry I read the issue too fast. What is causing the NPE? Is it e.g. the
call to getProtectionDomain() or getCodeSource()?
I assume you don't get the NPE when you're testing the class without PowerMock?!
Original comment by johan.ha...@gmail.com
on 24 Oct 2011 at 2:55
The real NPE occurs when calling getLocation().
FYI. The following is the output(toString()) for each call.
1. getProtectionDomain()
ProtectionDomain (null <no signer certificates>)
org.powermock.core.classloader.MockClassLoader@84abc9
<no principals>
null
2.getCodeSource()
(null <no signer certificates>)
Original comment by smartmar...@gmail.com
on 25 Oct 2011 at 12:30
Sorry. Forgot to say. Your assumption is correct. I don't get the NPE when
testing the class without PowerMock
Original comment by smartmar...@gmail.com
on 25 Oct 2011 at 12:31
Alright. This probably has to do with some bug or missing functionality in
PowerMock's classloader. I'll accept it as an issue. Please give us a hand and
try to investigate how it could be solved if you like. Issues like these are
usually quite hard to track down and fix and I'm not sure I'll find the time to
do so any time soon :(
Original comment by johan.ha...@gmail.com
on 25 Oct 2011 at 8:11
I'd love to help, but frankly speaking, I know little about Java class loader.
Do you have any suggestions I can follow?
Original comment by smartmar...@gmail.com
on 1 Nov 2011 at 1:14
Original issue reported on code.google.com by
smartmar...@gmail.com
on 14 Oct 2011 at 1:17