use of org.drools.compiler.compiler.DescrBuildWarning in project drools by kiegroup.
the class KnowledgeBuilderImpl method dumpGeneratedRule.
private void dumpGeneratedRule(PackageDescr descr, String resName, String src) {
File dumpDir = this.configuration.getDumpDir();
if (dumpDir != null) {
try {
String dirName = dumpDir.getCanonicalPath().endsWith("/") ? dumpDir.getCanonicalPath() : dumpDir.getCanonicalPath() + "/";
String outputPath = dirName + resName + ".drl";
try (FileOutputStream fos = new FileOutputStream(outputPath)) {
fos.write(src.getBytes());
} catch (IOException iox) {
this.addBuilderResult(new DescrBuildWarning(null, descr, descr.getResource(), "Unable to write generated rules the dump directory: " + outputPath));
}
} catch (IOException e) {
this.addBuilderResult(new DescrBuildWarning(null, descr, descr.getResource(), "Unable to access the dump directory"));
}
}
}
Aggregations