[rules-dev] [JBRULES-3630] RFC - ClassPathResources within ChangeSet are loaded using wrong ClassLoader

Mario Fusco mario.fusco at gmail.com
Mon Sep 24 05:06:42 EDT 2012


Chris,

I tried the reproduce your issue on the master branch with the very simple
test case (practically identical to the one you reported on the jira
ticket) that I am pasting below, but it works for me. I didn't try the same
on the 5.1.1 though. Anyway can you please confirm that my test should be
enough to reproduce your problem? Because, if so, I believe that, at least
on the master, this bug should be already fixed.

Thanks,
Mario

    @Test
    public void testClassLoader() throws Exception {
        // JBRULES-3630
        File jar = new
File("drools-compiler/src/test/resources/org/drools/compiler/xml/changeset/changeset.jar");
        assertTrue(jar.exists());
        ClassLoader classLoader = URLClassLoader.newInstance(new URL[]{
jar.toURI().toURL() }, getClass().getClassLoader());
        Resource changeSet =
ResourceFactory.newClassPathResource("changeset1Test.xml", classLoader);
        KnowledgeBuilderConfiguration conf =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null, classLoader);
        KnowledgeBuilder builder =
KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
        builder.add(changeSet, ResourceType.CHANGE_SET);
    }


On Sun, Sep 23, 2012 at 2:24 PM, Chris Rankin <rankincj at googlemail.com>wrote:

> On Sun, Sep 23, 2012 at 8:02 AM, Mark Proctor <mproctor at codehaus.org>
> wrote:
> > I reviewed the patch, it would be nice if there was a unit test too for
> this - to ensure we catch any future regressions.
>
> I can do that. You presumably need this patch against the "trunk",
> although this issue is apparently present in all releases since 5.1.1.
>
> Cheers,
> Chris
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20120924/e8594e9e/attachment.html 


More information about the rules-dev mailing list