From d7a6e1a08b976fb1363599412b7e13258f865999 Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Wed, 10 Jun 2009 14:45:32 +0000 Subject: [PATCH] OPENJPA-1125 committing patch from Rick Curtis. Preventing misleading enhancement message. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@783376 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/openjpa/enhance/PCEnhancerAgent.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancerAgent.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancerAgent.java index e8e40f53b..554164e26 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancerAgent.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancerAgent.java @@ -96,16 +96,17 @@ public class PCEnhancerAgent { InstrumentationFactory.getInstrumentation(log); if (inst != null) { premain("", inst); - } else { - // This needs to be set in this method AND in premain because - // there are two different paths that we can attempt to load the - // agent. One is when the user specifies a javaagent and the - // other is when we try to dynamically enhance. - loadAttempted = true; - } + return true; + } + // If we successfully get the Instrumentation, we will call premain + // where loadAttempted will be set to true. This case is the path + // where we were unable to get Instrumentation so we need to set the + // loadAttempted flag to true. We do this so we will only run + // through this code one time. + loadAttempted = true; } - return getLoadSuccessful(); + return false; } public static void premain(String args, Instrumentation inst) {