Search in sources :

Example 1 with NotFoundInstrumentException

use of com.navercorp.pinpoint.bootstrap.instrument.NotFoundInstrumentException in project pinpoint by naver.

the class ASMEngine method getClass.

@Override
public InstrumentClass getClass(InstrumentContext instrumentContext, ClassLoader classLoader, String className, byte[] classFileBuffer) throws NotFoundInstrumentException {
    if (className == null) {
        throw new NullPointerException("class name must not be null.");
    }
    try {
        if (classFileBuffer == null) {
            ASMClassNodeAdapter classNode = ASMClassNodeAdapter.get(instrumentContext, classLoader, JavaAssistUtils.javaNameToJvmName(className));
            if (classNode == null) {
                return null;
            }
            ApiMetaDataService apiMetaDataService = this.apiMetaDataService.get();
            return new ASMClass(objectBinderFactory, instrumentContext, interceptorRegistryBinder, apiMetaDataService, classLoader, classNode);
        }
        // Use ASM tree api.
        final ClassReader classReader = new ClassReader(classFileBuffer);
        final ClassNode classNode = new ClassNode();
        classReader.accept(classNode, 0);
        ApiMetaDataService apiMetaDataService = this.apiMetaDataService.get();
        return new ASMClass(objectBinderFactory, instrumentContext, interceptorRegistryBinder, apiMetaDataService, classLoader, classNode);
    } catch (Exception e) {
        throw new NotFoundInstrumentException(e);
    }
}
Also used : ClassNode(org.objectweb.asm.tree.ClassNode) NotFoundInstrumentException(com.navercorp.pinpoint.bootstrap.instrument.NotFoundInstrumentException) ClassReader(org.objectweb.asm.ClassReader) ApiMetaDataService(com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService) NotFoundInstrumentException(com.navercorp.pinpoint.bootstrap.instrument.NotFoundInstrumentException)

Aggregations

NotFoundInstrumentException (com.navercorp.pinpoint.bootstrap.instrument.NotFoundInstrumentException)1 ApiMetaDataService (com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService)1 ClassReader (org.objectweb.asm.ClassReader)1 ClassNode (org.objectweb.asm.tree.ClassNode)1