use of org.motechproject.mds.exception.loader.LoaderException in project motech by motech.
the class JavassistLoader method doWhenClassNotFound.
@Override
public void doWhenClassNotFound(String name) {
CtClass ctClass = MotechClassPool.getDefault().getOrNull(name);
if (null != ctClass) {
try {
ctClass.defrost();
byte[] bytecode = ctClass.toBytecode();
loadClass(new ClassData(name, bytecode));
} catch (IOException | CannotCompileException ex) {
throw new LoaderException("Unable to load class using Javassist: " + name, ex);
}
}
}
use of org.motechproject.mds.exception.loader.LoaderException in project motech by motech.
the class PristineBundleClassLoader method loadPristineClassBytecode.
private byte[] loadPristineClassBytecode(String name) {
String classpath = JavassistUtil.toClassPath(name);
URL classResource = bundle.getResource(classpath);
if (classResource != null) {
try (InputStream in = classResource.openStream()) {
return IOUtils.toByteArray(in);
} catch (IOException e) {
throw new LoaderException("Unable to load bytes in pristine class", e);
}
}
return null;
}
Aggregations