Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-6967

Problem with trunking idempotent filestore when parent directory not exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.12.1
    • 2.11.3, 2.12.2, 2.13.0
    • camel-core
    • None
    • windows 7

    • Unknown

    Description

      I've tried to test some route with JUnit test declared like below

      @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;
      
      }
      

      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

      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
      

      I guess it could be fixed like in a workaround below

      public class FileIdempotentRepositoryEx extends FileIdempotentRepository {
         @Override
          protected void trunkStore() {
              if(getFileStore().exists()){
                  super.trunkStore();
              }
          }
      }
      

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            agdula Andrzej Gdula
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: