Re: [Quickfix-developers] SessionSettings improvement (I hope!)...
Brought to you by:
orenmnero
|
From: Tom D. <to...@di...> - 2005-12-06 15:54:46
|
Hi, Toby...
No argument with any of that. But actually, I think the whole class
could use a good scrubbing. That odd construct "\r\n".indexOf(ch) I
borrowed from a piece of code just following the one I modified; it's in
there more than once. And that whole tokenizer is a bit hard to
follow. Also, I'd like to see the SessionSettings made into an
interface, so that other kinds of session settings could be created. In
my application, I've wrapped it with a class that lets me set the
settings individually and programatically (so I can fish the settings
from a master config file for the entire app), but the interface to
SessionSettings is kinda wierd -- I generate the InputStream to feed to
SessionSettings <smile>.
Tom...
Shepheard, Toby (London) wrote:
> You might find changing isValueCharacter to treat spaces as a valid
> value a cleaner approach, though I'm not sure if this might cause
> other problems. Given that the string is trimmed at the end though I
> think it would be ok.
>
> A word of warning on using "\r\n" - this is system dependent. You
> should use the system newline property instead.
>
> -----Original Message-----
> *From:* qui...@li...
> [mailto:qui...@li...] *On
> Behalf Of *Tom Dilatush
> *Sent:* 06 December 2005 15:29
> *To:* QuickFIX Developers
> *Subject:* [Quickfix-developers] SessionSettings improvement (I
> hope!)...
>
> Hi, folks...
>
> I've just started using QuickFIX/J for a production project. I
> had a bit of trouble getting it going, and it turned out that the
> problem was a data dictionary setting with a file name that
> included spaces (this is hosted on a Windows system). This is
> inconvenient, nothing more, but I fixed the problem with the
> change shown below, to the getToken() method of
> SessionSetting.Tokenizer. The original code is in blue, the new
> in red.
>
> Tom...
>
> } else if (ch == '=') {
> ch = nextCharacter(inputStream); // wrong
> skipWhitespace(inputStream);
> if (isValueCharacter(ch)) {
>
> /* original block of code, failed on file
> names including spaces
> sb.setLength(0);
> do {
> sb.append(ch);
> ch = nextCharacter(inputStream);
> } while (isValueCharacter(ch));
> return new Token(VALUE_TOKEN, sb.toString());
> */
>
> /* replacement block */
> sb.setLength(0);
> do {
> sb.append(ch);
> ch = nextCharacter(inputStream);
> } while ("\r\n".indexOf(ch) == -1);
> return new Token(VALUE_TOKEN,
> sb.toString().trim());
> /* end replacement block */
> }
>
> ------------------------------------------------------------------------
> If you are not an intended recipient of this e-mail, please notify the
> sender, delete it and do not read, act upon, print, disclose, copy,
> retain or redistribute it. Click here
> <http://www.ml.com/email_terms/>for important additional terms
> relating to this e-mail. http://www.ml.com/email_terms/
> ------------------------------------------------------------------------
|