"flavia.rainone(a)jboss.com" wrote : "alesj" wrote : I wouldn't go
with this null, but just with a simple CP exclude -- only for tests purposes.
| | e.g.
| | Map the AppCL with DefaultCP, but somehow exclude all but java.* and our test
packages.
| | Actually make this exclusion configurable, as we have it in CL/Deployers.
| |
| The point with null is to reproduce the fact that String.class.getClassLoader() is
null.
| The problem is that we won't be able of mapping all the bootstrap just by matching
the package names.
| If you prefer to have the exclusion for ClassPools, then we will go that way. I'll
let you know when this is done so you can finally debug the failure you are seeing.
I've done some investigation, trying to find a better solution, but it looks like
there isn't one, really. The only thing I can do is doing this exclusion not invasive
in the code, or as Ales said, making it configurable:
| interface ClassPoolParentFactory
| {
| public ClassPool getClassPoolParent(ClassLoader classLoader)
| }
|
| class DefaultClassPoolParentFactory implements ClassPoolParentFactory
| {
| public ClassPool getClassPoolParent(ClassLoader classLoader)
| {
| if (classLoader == null) return ClassPool.getDefault();
| else return repository.register(classLoader);
| }
| }
|
And then, in the tests:
| class FilteredClassPoolParentFactory
| {
|
|
| public ClassPool getClassPoolParent(ClassLoader classLoader)
| {
| if (classLoader == null)
| return new FilteredClassPoolAdapter(ClassPool.getDefault(),
classFilter);
| else return repository.register(classLoader);
| }
| }
|
| class FilteredClassPoolAdapter extends ClassPool
| {
| private ClassPool delegate;
| private ClassFilter filter;
|
| public void get(String className) throws NotFoundException
| {
| if (filter.matchesClassName(className))
| {
| delegate.get(className);
| }
| throw new NotFoundException("...");
| }
| ....
| }
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269991#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...