From 41dd8d9f6f4e31d3383e35e66b6fdfa79c3d94e5 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Mon, 24 Mar 2008 14:31:47 -0700 Subject: [PATCH] 6239043: 4/4 TransformerManagementThreadAddTests.java failed Clear fCheckedTransformers in order to properly record transformer() call data. Reviewed-by: sspitsyn --- .../TransformerManagementThreadAddTests.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/jdk/test/java/lang/instrument/TransformerManagementThreadAddTests.java b/jdk/test/java/lang/instrument/TransformerManagementThreadAddTests.java index cc5a4b68940..5c19a41771f 100644 --- a/jdk/test/java/lang/instrument/TransformerManagementThreadAddTests.java +++ b/jdk/test/java/lang/instrument/TransformerManagementThreadAddTests.java @@ -79,6 +79,12 @@ public class TransformerManagementThreadAddTests extends ATestCaseScaffold protected static final int TOTAL_THREADS = MAX_TRANS - MIN_TRANS + 1; private byte[] fDummyClassBytes; + // fCheckedTransformers is a Vector that is used to verify + // that the transform() function is called in the same + // order in which the transformers were added to the + // TransformerManager. The test currently verifies that all + // transformers for a specific worker thread are in + // increasing order by index value. private Vector fCheckedTransformers; private Instrumentation fInstrumentation; private int fFinished; @@ -264,11 +270,19 @@ public class TransformerManagementThreadAddTests extends ATestCaseScaffold private void executeTransform() { - fCheckedTransformers.clear(); - try { ClassDefinition cd = new ClassDefinition(DummyClass.class, fDummyClassBytes); + + // When the ClassDefinition above is created for the first + // time and every time redefineClasses() below is called, + // the transform() function is called for each registered + // transformer. We only want one complete set of calls to + // be logged in the fCheckedTransformers Vector so we clear + // any calls logged for ClassDefinition above and just use + // the ones logged for redefineClasses() below. + fCheckedTransformers.clear(); + getInstrumentation().redefineClasses(new ClassDefinition[]{ cd }); } catch (ClassNotFoundException e)