wujun / powermock

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

powerMock 1.5 throwsjava.lang.IllegalStateException: Failed to transform class with name #424

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I use Junit 4.8.2, easymock 3.1 powerMock 1.5 and maven-surefire-plugin 2.9, 
why there is this exception: 
java.lang.IllegalStateException: Failed to transform class with name 
com.bull.eris.reg.service.request.TestRegistrationApplication. Reason: 3
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:219)
    at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:147)
    at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:67)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:132)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:39)
    at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:217)
    at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:59)
    at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
    at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:32)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:41)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:31)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
    at javassist.bytecode.ByteArray.write16bit(ByteArray.java:40)
    at javassist.bytecode.StackMapTable$Shifter.update(StackMapTable.java:744)
    at javassist.bytecode.StackMapTable$Shifter.sameFrame(StackMapTable.java:720)
    at javassist.bytecode.StackMapTable$Walker.stackMapFrames(StackMapTable.java:194)
    at javassist.bytecode.StackMapTable$Walker.parse(StackMapTable.java:179)
    at javassist.bytecode.StackMapTable$Shifter.doit(StackMapTable.java:714)
    at javassist.bytecode.StackMapTable.shiftPc(StackMapTable.java:693)
    at javassist.bytecode.CodeIterator.insertGap0(CodeIterator.java:676)
    at javassist.bytecode.CodeIterator.insertGap(CodeIterator.java:636)
    at javassist.bytecode.CodeIterator.insertGapCore(CodeIterator.java:467)
    at javassist.bytecode.CodeIterator.insertGap(CodeIterator.java:413)
    at javassist.expr.Expr.replace0(Expr.java:298)
    at javassist.expr.FieldAccess.replace(FieldAccess.java:213)
    at org.powermock.core.transformers.impl.MainMockTransformer$PowerMockExpressionEditor.edit(MainMockTransformer.java:276)
    at javassist.expr.ExprEditor.loopBody(ExprEditor.java:197)
    at javassist.expr.ExprEditor.doit(ExprEditor.java:90)
    at javassist.CtClassType.instrument(CtClassType.java:1289)
    at org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:75)
    at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:215)
    ... 29 more

Who can help me? thx a lot

Original issue reported on code.google.com by bienvenueqin@gmail.com on 22 Jan 2013 at 3:32

Attachments:

GoogleCodeExporter commented 9 years ago
I suspect that you should bring this up on the Javassist forums. Just to make 
sure, are you using Java 6 or 7?

Original comment by johan.ha...@gmail.com on 22 Jan 2013 at 7:54

GoogleCodeExporter commented 9 years ago
java 6

Original comment by bienvenueqin@gmail.com on 22 Jan 2013 at 8:04

GoogleCodeExporter commented 9 years ago
Then it should be supported by Javassist so it might be an issue at their side.

Original comment by johan.ha...@gmail.com on 22 Jan 2013 at 8:09