[
https://issues.jboss.org/browse/DROOLS-2338?page=com.atlassian.jira.plugi...
]
Alexander Kotikhov commented on DROOLS-2338:
--------------------------------------------
{code:java}
@Test
public void testHelloWorldWithSpace() throws Exception {
final KieServices kieServices = KieServices.get();
final Path dir = Paths.get("/tmp/t tt");
Files.createDirectories(dir);
final String text = "rule \"Hello world rule\"\n" +
"when\n" +
" " +
"then\n" +
" System.out.println(\"Hello world\");" +
"end\n";
final Path filePath = dir.resolve("one.drl");
Files.write(filePath, text.getBytes());
final KieFileSystem fs = kieServices.newKieFileSystem();
fs.write(ResourceFactory.newUrlResource("file:/tmp/t%20tt/one.drl"));
KieBuilder kieBuilder = kieServices.newKieBuilder(fs);
kieBuilder.buildAll();
KieModule kieModule = kieBuilder.getKieModule();
KieSession ksession =
kieServices.newKieContainer(kieModule.getReleaseId()).newKieSession();
ksession.insert(new Object());
int count = ksession.fireAllRules();
assertEquals( 1, count );
}
{code}
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)