Greg Wooledge ([EMAIL PROTECTED]) wrote:

> java freenet.node.Main --export   produces a corrupted node reference
> on stdout

Additional information:

 * It happens with both Linux/SunJava and OpenBSD/Kaffe
 * It happens with both build 553 and build 546
 * It does not happen if there is a filename parameter after the --export

The relevant code seems to be this:

            // --export
            // (no need to load up the full node)
            if (sw.getParam("export") != null) {
                writeFieldSet(myRef.getFieldSet(),
                              sw.getString("export"));
                return;
            }

sw.getString("export") must be returning a null pointer or something,
(or whatever the hell Java uses instead of null pointers), but
writeFieldSet doesn't seem to check this.  Instead, it only checks
to see if the file name is "-".  When writeFieldSet gets the null
pointer, Bad Things Happen.

A usage check like

                if (sw.getString("export") == null) {
                        complainLoudly();
                        die();
                }

would be sufficient, I think.

-- 
Greg Wooledge                  |   "Truth belongs to everybody."
[EMAIL PROTECTED]              |    - The Red Hot Chili Peppers
http://wooledge.org/~greg/     |

Attachment: msg06583/pgp00000.pgp
Description: PGP signature

Reply via email to