Hy,

I'm currently working my way into another project (ObjectRelationalBridge
at http://objectbridge.sourceforge.net/), which uses hsqldb as its primary
development database (or at least it comes configured for hsqldb by
default). Additionally it uses the CodeSwitcher for some functionally
(actually, I'm not quite sure if its prober, 'cause they use it to handle
non-java files, but it works).

Now I found out that the CodeSwitcher Tool has a problem with newline
handling. Basically it allways writes windows-style newlines ("\r\n")
regardless of which platform it runs on. As far as java is concerned this
is no problem at all, since Java handles all the kinds of newline equally
well (even mixed in the same file), but as soon as CVS or (any other
non-java system) comes into the mix trouble starts:

When you check a file into CVS from unix, that was handled by the
CodeSwitcher CVS assumes that it gets unix-style newline characters, 'cause
it is a text-file and it comes from a unix system. But this is no longer
true, since CodeSwitcher uses \r\n. As long as you check it out of CVS on
unix again, everything is fine (you'll have windows-style newlines, but
most unix-tools handle this just fine), but when you now check this file
out from a windows-system CVS automatically converts the second \n (which
it thinks is the real newline) to a windows-style newline, which results in
every line beeing terminated with "\r\r\n", which is quite bad. The problem
is usually not noticed, 'because most tools just ignore the spurious \r,
but some dont.

After all this talk, let's actually do something ;-) I've changed
CodeSwitcher.java to use the System property line.seperator instead of the
hardcoded "\r\n". The patch is rather trivial and I attached it for your
viewing pleasure. (sorry, Lotus Notes (cursed be it) seems to truncate file
names)

regards
Joachim Sauer

(See attached file: CODESW~1.DIF)

Attachment: CODESW~1.DIF
Description: Binary data

Reply via email to