Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-184

kieResources.newClassPathResource() violates the Class.getResource() conventions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 6.0.0.Beta4
    • None
    • None

      Suppose I have a jar like this:

      cheeseProject-1.0.0.jar
        /org/cheese/MyCheeseApp.class
        /org/cheese/myCheeseRules.drl
      

      There are 2 ways in plain old Java, to get that drl classpath resource:

        getClass().getResource("/org/cheese/myCheeseRules.drl") // OK
        getClass().getResource("myCheeseRules.drl") // OK
      

      The KnowledgeBase's classpath resource creation expected similar parameters.

      In KieBase I expected it to work in the same way:

      kieResources.newClassPathResource("/org/cheese/myCheeseRules.drl") // FAILS
      kieResources.newClassPathResource("myCheeseRules.drl", MyCheeseApp.class) // FAILS
      

      Instead it expects something like this:

      kieResources.newClassPathResource("src/main/resource/xxx/org/cheese/myCheeseRules.drl") // ???
      

      That's not compatible with the JDK definition of a classpath resource, and therefore shouldn't be called newClassPathResource(...). And I 'd like to be able to use the real newClassPathResource() variation.

            etirelli@redhat.com Edson Tirelli
            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: