]
Mario Fusco resolved DROOLS-5923.
---------------------------------
Resolution: Explained
You're misusing the ResourceType. Just pass the existing ResourceType.DRL and it
works.
ResourceType does not work
--------------------------
Key: DROOLS-5923
URL:
https://issues.redhat.com/browse/DROOLS-5923
Project: Drools
Issue Type: Bug
Reporter: yj jiang
Assignee: Mario Fusco
Priority: Major
I use drools as follow:
{code:java}
import org.kie.internal.utils.KieHelper;
// code placeholder
public static final ResourceType LOCAL_DRL =
ResourceType.addResourceTypeToRegistry("DRL",
"Drools Rule Language",
"src/main/resources/com/jiang",
"drl");
public KieSession loadForRule2(String drlStr) {
KieHelper helper = new KieHelper();
helper.addContent(drlStr, LOCAL_DRL);
return helper.build().newKieSession();
}
{code}
This param *defaultPath* dose not work, I see that the code is fixed,
{code:java}
// code placeholder
private String generateResourceName(ResourceType type) {
return "src/main/resources/file" + counter++ + "." +
type.getDefaultExtension();
}
{code}
I think it should be changed as follows
{code:java}
// code placeholder
private String generateResourceName(ResourceType type) {
return type.getDefaultPath() + counter++ + "." +
type.getDefaultExtension();
}{code}
Now,i use another function to temporarily solve
{code:java}
// code placeholder
helper.addContent(drlStr, "/com/jiang/ww.drl");
{code}