[sword-devel] SWConfig.java

Mike Dougherty sword-devel@crosswire.org
10 Dec 2001 10:48:56 -0800

On Mon, 2001-12-10 at 03:35, Troy A. Griffitts wrote:
> Mike,
> 	Thank you for taking the time to rewrite SWConfig.java!  It's so fresh
> to get code submitted!  Bobby and you have been a blessing to me this
> weekend!

No worries. It was kind of fun playing with this to make it have the
desired effect.

> I've changed all code in the api to use the new interface. 
> Anyway I can get you to finish the write interface? :)  

Sure. However, this may be a little more tricky. The Properties object
doesn't sort the properties (or keep them in any particular order), nor
does it save comments which are both fixable. It's also missing some
other desired writing effects, see below.

> I'm very impressed and still don't understand how you read the .ini style file. 

The Properties object does most of that for me already. It reads a
simple text file with name=value (actually separators can be any of "=:
\t\r\n\f") pairs, does some processing (unicode and other character
translations), and stores them as Strings in a Hashtable.

> One thing I was going to change and couldn't find where, was that the
> rtf codes in the .conf file (\par \qc, etc) are not preserving the \. 

This is kind of a special case so it is not part of the functionality in
the standard Properties object. I guess I didn't read the code well
enough to get that out of it.

> The only special meaning a '\' has in a .conf file is at the very end of
> a line to designate a continuation-- all other \'s are literals.

It does interpret '\' as a line continuation character, not a newline
character. Also, when it writes it back out, it doesn't put the line
continuation (or a newline) character back in. Need to do some more
tweaking on this.

Actually, rather than trying to fix all this with a subclass I think I
will actually steal the source of the java.util.Properties and create a
org.crosswire.util.Properties object, with appropriate fixes. I'm pretty
sure we are allowed to do that as long as we don't try and pass it off
as a java.util.Properties implementation, so it's not "really" stealing.

>  Thanks again for providing a solution to the subject of debate these past
> couple days!
> 	In Him,
> 		-Troy.
> PS.  Your attached file seems to have prepended garbled character
> somewhere in the copyright (or netscape is having trouble handling the
> attachment).
> >                     Name: SWConfig.java
> >    SWConfig.java    Type: text/x-c
> >                 Encoding: quoted-printable

Hmmm... not sure why but it looks like my mailer is doing some strange
stuff with the mime type. Could be the problem. Let me look into it
before I send the next file.


 Mike Dougherty -- Java Software Engineer
 "No problem is so formidable that you can't walk away from it."
  -- C. Schulz