Andrzej Gdula created CAMEL-6967:
------------------------------------

             Summary: Problem with trunking idempotent filestore when parent 
directory not exists
                 Key: CAMEL-6967
                 URL: https://issues.apache.org/jira/browse/CAMEL-6967
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.12.1
         Environment: windows 7
            Reporter: Andrzej Gdula


I've tried to test some route with JUnit test declared like below
{code}
@RunWith(CamelSpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = CoreRouterConfiguration.class, loader = 
CamelSpringDelegatingTestContextLoader.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public class RouteTestBase {
    @Produce
    protected ProducerTemplate producerTemplate;

    @Autowired
    protected ModelCamelContext context;

}
{code}

Camel context starts and then it's beeing shutdown. It there's a 
FileIdempotentRepository with nonexisting path then camel contexf fails to 
shutdown with exception
{code}
Caused by: java.io.FileNotFoundException: .\TempData\meta\mrdf-idempotent.dat 
(The system cannot find the path specified)
        at java.io.FileOutputStream.open(Native Method) ~[na:1.7.0_40]
        at java.io.FileOutputStream.<init>(FileOutputStream.java:221) 
~[na:1.7.0_40]
        at java.io.FileOutputStream.<init>(FileOutputStream.java:171) 
~[na:1.7.0_40]
        at 
org.apache.camel.processor.idempotent.FileIdempotentRepository.trunkStore(FileIdempotentRepository.java:256)
 ~[camel-core-2.12.1.jar:2.12.1]
        ... 50 common frames omitted
{code}

I guess it could be fixed like in a workaround below
{code}
public class FileIdempotentRepositoryEx extends FileIdempotentRepository {
   @Override
    protected void trunkStore() {
        if(getFileStore().exists()){
            super.trunkStore();
        }
    }
}
{code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to