Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add better reporting if ASM fails to parse a class with an unspecified RuntimeException #174

Merged
merged 1 commit into from
Sep 2, 2020

Conversation

uschindler
Copy link
Member

This PR adds a detailed error message when a broken class file occurs.

This closes #173

@vlsi
Copy link
Contributor

vlsi commented Nov 29, 2020

Just in case, I've upgraded to forbidden-apis 3.1, and the feature works. Thanks.

Build calcite FAILURE reason:                                
    Execution failed for task ':core:forbiddenApisMain':
        Caused by: de.thetaphi.forbiddenapis.ForbiddenApiException: Failed to parse class 'org.apache.calcite.adapter.enumerable.RexToLixTranslator' (RexToLixTranslator.java): java.lang.ArrayIndexOutOfBoundsException: 9
            at de.thetaphi.forbiddenapis.Checker.checkClass(Checker.java:440)
            at de.thetaphi.forbiddenapis.Checker.run(Checker.java:460)
            at de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis.checkForbidden(CheckForbiddenApis.java:601)
            at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:555)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:540)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:523)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:271)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:260)
            at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:34)
            at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:34)
            at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
            at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
            at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
            at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
            at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
            at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
            at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
            at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
            at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
            at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
            at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
            at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:42)
            at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
            at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
            at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
            at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
            at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
            at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
            at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
            at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
            at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
            at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
            at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
            at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
            at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
            at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
            at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
            at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
            Caused by: java.lang.ArrayIndexOutOfBoundsException: 9
                at de.thetaphi.forbiddenapis.asm.ClassReader.readLabel(ClassReader.java:2643)
                at de.thetaphi.forbiddenapis.asm.ClassReader.createLabel(ClassReader.java:2659)
                at de.thetaphi.forbiddenapis.asm.ClassReader.readTypeAnnotations(ClassReader.java:2724)
                at de.thetaphi.forbiddenapis.asm.ClassReader.readCode(ClassReader.java:1892)
                at de.thetaphi.forbiddenapis.asm.ClassReader.readMethod(ClassReader.java:1481)
                at de.thetaphi.forbiddenapis.asm.ClassReader.accept(ClassReader.java:711)
                at de.thetaphi.forbiddenapis.asm.ClassReader.accept(ClassReader.java:394)
                at de.thetaphi.forbiddenapis.Checker.checkClass(Checker.java:414)
                ... 62 more

@uschindler
Copy link
Member Author

Thanks for the feedback! 😉

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Ability to skip class file parse errors
2 participants