Skip to content

Commit

Permalink
fixed #124
Browse files Browse the repository at this point in the history
  • Loading branch information
skybber committed Apr 20, 2016
1 parent 478da7f commit e1d7d17
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
@Plugin(name = "JBossModules",
description = "JBossModules - Jboss modular class loading implementation. ",
testedVersions = {"1.4.4"},
testedVersions = {"1.4.4, 1.5.1"},
expectedVersions = {"1.x"},
supportClass={ModuleClassLoaderTransformer.class}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,31 @@ public static void patchModuleClassLoader(ClassPool classPool, CtClass ctClass)
);

CtMethod methRecalculate = ctClass.getDeclaredMethod("recalculate");
methRecalculate.setBody(
"{" +
" final org.jboss.modules.Paths p = this.paths" + pathsGetter + ";" +
" boolean ret = setResourceLoaders(p, (org.jboss.modules.ResourceLoaderSpec[])p.getSourceList(NO_RESOURCE_LOADERS));" +
methRecalculate.setName("_recalculate");

ctClass.addMethod(CtNewMethod.make(
"boolean recalculate() {" +
" boolean ret = _recalculate();" +
" __setupPrepend();" +
" return ret;" +
"}"
);
"}",
ctClass
));


CtClass ctResLoadClass = classPool.get("org.jboss.modules.ResourceLoaderSpec[]");

CtMethod methResourceLoaders = ctClass.getDeclaredMethod("setResourceLoaders", new CtClass[] { ctResLoadClass });
methResourceLoaders.setBody(
"{" +
" boolean ret = setResourceLoaders(this.paths" + pathsGetter + ", $1);" +
" boolean ret = setResourceLoaders((org.jboss.modules.Paths)this.paths" + pathsGetter + ", $1);" +
" __setupPrepend();" +
" return ret;" +
"}"
);

} catch (NotFoundException e) {
LOGGER.warning("Unable to find field \"paths\" in org.jboss.modules.ModuleClassLoader.");
LOGGER.warning("Unable to find field \"paths\" in org.jboss.modules.ModuleClassLoader.", e);
}
}

Expand Down Expand Up @@ -133,7 +136,7 @@ public static void patchModulesPaths(ClassPool classPool, CtClass ctClass) throw
"}", ctClass)
);
} catch (NotFoundException e) {
LOGGER.warning("Unable to find methos \"getAllPaths()\" in org.jboss.modules.Paths.");
LOGGER.warning("Unable to find method \"getAllPaths()\" in org.jboss.modules.Paths.", e);
}
}

Expand Down

0 comments on commit e1d7d17

Please sign in to comment.