Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8210905

Java instrumentation API swallows RuntimeException

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Linux, Java 8

      A DESCRIPTION OF THE PROBLEM :
      While implementing a Java agent, which uses a bytecode manipulation library to transform classes, the library throws a Runtime exception, which is not reported.

      REGRESSION : Last worked in version 8u192

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Implement a Java agent which transforms class files using the transformer below:

      import java.lang.instrument.*;
      import java.security.ProtectionDomain;


      public class Transformer implements ClassFileTransformer {

          public byte[] transform(
                                  ClassLoader loader,
                                  String className,
                                  Class<?> classBeingRedefined,
                                  ProtectionDomain protectionDomain,
                                  byte[] classfileBuffer) {


              System.err.println("Transforming: "+className);
              if (1 == 1)
                  throw new RuntimeException("runtime error");
              return classfileBuffer;

          }

      }




      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Runtime exception during class file transformation
      ACTUAL -
      Execution proceeds without reporting any errors.

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              sspitsyn Serguei Spitsyn
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: