// visitor and th eonly safe ting to do is back out the whole transform.
ClassReader cr = new ClassReader(targetClassBytes);
// need to provide a real writer here so that labels get resolved
ClassWriter dummy = getNonLoadingClassWriter(0);
RuleCheckAdapter checkAdapter = handlerLocation.getRuleCheckAdapter(dummy, this);
try {
// insert a local scope adapter between the reader and the adapter so
// we see info about vars going in and out of scope
BMLocalScopeAdapter localScopeAdapter = new BMLocalScopeAdapter(checkAdapter);
cr.accept(localScopeAdapter, ClassReader.EXPAND_FRAMES);
} catch (TransformFailure te) {
// will already be notified
return targetClassBytes;
} catch (Throwable th) {
// hmm, unexpected error
if (Transformer.isVerbose()) {
System.out.println("org.jboss.byteman.agent.Transformer : unexpected error applying rule " + ruleScript.getName() + " to class " + triggerClassName + "\n" + th);
th.printStackTrace(System.out);
}
recordFailedTransform(th);
return targetClassBytes;
}
// only insert the rule trigger call if there is a suitable location in the target method
if (!checkAdapter.isVisited()) {
// there was no matching method so ignore
return targetClassBytes;
}
if (Transformer.isVerbose()) {