[QFJ-28] FileStore: working directory patch Created: 14/Jun/06  Updated: 02/Sep/06  Resolved: 17/Jun/06

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: None
Fix Version/s: 1.0.1

Type: Improvement Priority: Major
Reporter: Steve Bate Assignee: Steve Bate
Resolution: Fixed Votes: 0
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



 Comments   
Comment by Steve Bate [ 14/Jun/06 ]

Index: src/quickfix/FileStore.java
===================================================================
— src/quickfix/FileStore.java (revision 416)
+++ src/quickfix/FileStore.java (working copy)
@@ -67,6 +67,8 @@
if (path == null)

{ path = "."; }

+ path = new File(path).getAbsolutePath();
+
String sessionId = sessionID.getBeginString() + "" + sessionID.getSenderCompID() + ""
+ sessionID.getTargetCompID();
if (sessionID.getSessionQualifier() != null && !sessionID.getSessionQualifier().equals("")) {

Comment by Steve Bate [ 17/Jun/06 ]

Unfortunately, the changes were committed with a different issue number so they aren't linked here.

Generated at Sat Nov 23 07:15:48 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.