[
https://issues.jboss.org/browse/DROOLS-2338?page=com.atlassian.jira.plugi...
]
Alexander Kotikhov updated DROOLS-2338:
---------------------------------------
Steps to Reproduce:
Create directory with space character.
Put any *.drl files there.
{code:java}
private KieContainer createKieContainer() throws IOException {
final KieServices kieServices = KieServices.get();
final KieFileSystem fs = kieServices.newKieFileSystem();
// iterate all files
ResourcePatternResolver resourcePatternResolver = new
PathMatchingResourcePatternResolver();
final Resource[] resources = resourcePatternResolver.getResources(baseDirectory +
"*.drl");
for (Resource res : resources) {
logger.info("Add file to build " + res.getFilename());
fs.write(ResourceFactory.newUrlResource(res.getURL()));
}
KieBuilder kieBuilder = kieServices.newKieBuilder(fs);
kieBuilder.buildAll();
KieModule kieModule = kieBuilder.getKieModule();
return kieServices.newKieContainer(kieModule.getReleaseId());
}
{code}
then try to use createKieContainer() - no rules exist.
was:
Create directory with space character.
Put any *.drl files there.
{code:java}
private KieContainer createKieContainer() throws IOException {
final KieServices kieServices = KieServices.get();
final KieFileSystem fs = kieServices.newKieFileSystem();
// iterate all files
ResourcePatternResolver resourcePatternResolver = new
PathMatchingResourcePatternResolver();
final Resource[] resources = resourcePatternResolver.getResources(baseDirectory +
"*.drl");
for (Resource res : resources) {
logger.info("Add file to build " + res.getFilename());
fs.write(ResourceFactory.newUrlResource(res.getURL()));
}
KieBuilder kieBuilder = kieServices.newKieBuilder(fs);
kieBuilder.buildAll();
KieModule kieModule = kieBuilder.getKieModule();
return kieServices.newKieContainer(kieModule.getReleaseId());
}
{code}
then try to use createKieContainer() - no rules exists.
MemoryFileSystem losts contents of files all DRL scripts become
"empty" if directory contains a space character
---------------------------------------------------------------------------------------------------------------
Key: DROOLS-2338
URL:
https://issues.jboss.org/browse/DROOLS-2338
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 7.4.1.Final, 7.5.0.Final, 7.6.0.Final
Environment: any
Reporter: Alexander Kotikhov
Assignee: Mario Fusco
Attachments: Снимок экрана от 2018-02-19 18-08-49.png
If a directory where any files are placed contains spaces
MemoryFileSystem.getFile(String path) returns object with truncated name.
To fix this error (in version 7.4.0) it is nessassary line 107
*String name = decode( path ).substring( lastSlashPos + 1 );*
replace with
*String name = decode( path.substring( lastSlashPos + 1 ) );*
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)