Uploaded image for project: 'QuickFIX/J'
  1. QuickFIX/J
  2. QFJ-28

FileStore: working directory patch

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.1
    • Component/s: Engine
    • Labels:
      None

      Description

      Ok, my apologies for sending an incomplete email earlier. Had an
      "enter key" malfunction.

      I'm working on a multi-module project driven by Maven (instead of
      ant), where couple of the modules use QuickfixJ.

      The directory layout is as follows:
      parentModule

      • childModule
      • src
      • test
      • java
        *.java files are here

      I'm noticing a very strange situation: i have a unit test that runs
      just fine if you run it directly from the <childModule> directory, it
      initializes the Session correctly which creates the appropriate
      output/ and store/ directories for FIX.4.2-xxx files.

      However, if i run the same test from a parent directory (ie one level
      up) then it fails in to create/locate the output/ directory:
      java.io.FileNotFoundException:
      output/data/server/FIX.4.2-test-exchange-test-sender.body (No such
      file or directory)
      java.lang.RuntimeException: java.io.FileNotFoundException:
      output/data/server/FIX.4.2-test-exchange-test-sender.body (No such
      file or directory)
      at quickfix.FileStoreFactory.create(FileStoreFactory.java:65)
      at quickfix.Session.<init>(Session.java:191)
      at quickfix.DefaultSessionFactory.create(DefaultSessionFactory.java:125)
      at quickfix.mina.acceptor.AbstractSocketAcceptor.createSessions(AbstractSocketAcceptor.java:129)

      with the real error coming from here:
      Caused by: java.io.FileNotFoundException:
      output/data/server/FIX.4.2-test-exchange-test-sender.body (No such
      file or directory)
      at java.io.RandomAccessFile.open(Native Method)
      at java.io.RandomAccessFile.<init>(Unknown Source)
      at java.io.RandomAccessFile.<init>(Unknown Source)
      at quickfix.FileStore.initialize(FileStore.java:97)
      at quickfix.FileStore.<init>(FileStore.java:87)
      at quickfix.FileStoreFactory.create(FileStoreFactory.java:63)

      I've traced the cause of the error itself to a Maven bug (incorrect
      working dir setup) which i've filed with them:
      http://jira.codehaus.org/browse/MSUREFIRE-133

      In QuickFixJ it gets manifested in quickfix.FileStore class
      constructor. If the incoming "path" is changed to be an absolute path
      (instead of relative) the rest of initialization works fine.

      I understand this a maven bug and not Quickfix, but i was hoping you
      would incorporate the workaround for it anyway b/c it makes sense
      regardless: it's just to take the incoming path and to always treat it
      as an absolute path. That makes the code more defensive.

      It's a one-line change. all the unit tests pass.

      I"m attaching a patch for the changes (it's just one line).

      toli

        Attachments

          Activity

            People

            • Assignee:
              admin Steve Bate
              Reporter:
              admin Steve Bate
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: