[ggo-discussion] Re: possible bug on first time installation

  • From: Peter Strempel <zotan@xxxxxx>
  • To: ggo-discussion@xxxxxxxxxxxxx
  • Date: Fri, 10 Jan 2003 06:01:47 +0100

On Fri, 10 Jan 2003 12:05:57 +0900, Taegil Noh <nayas@xxxxxxxxxxxxxxx>
wrote:

> $ java -jar gGo.jar
> Could not load file '/home/nayas/.ggorc'
> java.io.FileNotFoundException: /home/nayas/.ggorc (No such file or
> directory)

So far this is no error, actually. Although I admit it looks like one and 
is
somewhat confusing. I just added a line here reading:
"If you run gGo the first time, this is no error. Default settings are 
created."

This is the code snipplet:

       try {
            propFile = System.getProperty("user.home") + "/.ggorc";
        } catch (AccessControlException e) {
            System.err.println("Failed to get property file: " + e);
            initDefaults(true);
            return;
        }

(This exception is thrown when running as applet and we didnt accept the
signature. For the standalone application this doesnt matter.)

        try {
            FileInputStream in = new FileInputStream(propFile);
            props.load(in);
            in.close();
        } catch (FileNotFoundException e) {
            System.err.println("Could not load file '" + propFile + "' " + 
e +
                "If you run gGo the first time, this is no error. Default
settings are created.\n");     (That line is new)
            err = true;
        } catch (IOException e) {
            System.err.println("Could not load file '" + propFile + "'\n" + 
e);
            err = true;
        }

(First exception is thrown when there is no file $HOME/.ggorc. This is not
necassarily an error. Normal behaviour when gGo starts the first time. I do 
not
want to install a default config file and rather let the application create 
it.
Second exception is usually an error, something serious would have gone 
wrong
here.)

        if (!err)
            initSettings();
        else
            initDefaults(true);

(initSettings loads our configuration from the .ggorc file, initDefaults 
will
create the default configuration. That true is sort of hard-reset, 
everything is
set to default here. However, the .ggorc file is not yet saved, as nothing 
was
altered at that point. So you could theoretically start gGo a dozen times, 
close
it instantly and get the missing file message everytime. The file is saved 
the
first time you open one of the dialogs where you can alter the options.
That "if err" code is probably not the most elegant style, but that is just
cosmetical.)


In theory the above code should work, and it actually does for me. I just 
moved
my .ggorc out of the way and started the client, got that missing file 
message,
configured my IGS config, then the new .ggorc was on my harddisc. Exactly 
the
behaviour it is supposed to show.


> And the program hangs up. nothing.
> (running script gGo or ggo makes the same result.)

Now, this is strange. It _should_ not hang up but start with the just 
created
defaults. There is a file $HOME/.ggo.log where stderr gets redirected to
(however not yet when the configuration is loaded, so you got the above 
message
in your xterm). If something strange happens, please have a look in 
.ggo.log and
in case email me the file. Please note, the log is overwritten everytime 
you
start gGo, so copy it away in time.
I cannot say what exactly is going wrong here without more details, but I
suppose it is not a problem with the config file.


> after touching an empty file ...
>
> $ touch ~/.ggorc
>
> it runs. though with errors, (no real rc informations are there ...)
> and cannot save connection / preference informations.
>
>
> Failed to convert string to integer: java.lang.NumberFormatException:
> null ( 10 times this error )
> (...)
> Failed to convert string to float: java.lang.NullPointerException
> Failed to convert string to integer: java.lang.NumberFormatException:
> null
> Not host config found.
>


Uh oh. That is ugly. If there is an empty .ggorc file, then gGo will *not* 
init
the default settings, because in the above code the file-not-found 
exception was
not thrown. So gGo will try to load all settings from an empty file, which
results in those mentioned NumberFormatException errors. (Cannot convert a 
null
String to an Integer.)
Actually, giving gGo an empty file can wreck things seriously. Maybe I 
should
add some check here, but so far noone has tried that yet and told me. :*)
But I rest in good confidence, when a threaded user manually edits the 
config
file and things go wrong, I am not to be blamed. I admit the idea with 
"touch"
was good and I had probably done that, too, but as my code works right now, 
this
cannot fix it. Theoretically the missing config file should not cause any
problem.


>
> I think this maybe a possible bug for first time installation. It should
> make a default value .ggorc file, but it does not.

As I said above, the first time you alter some options, the .ggorc file is
saved. However, in your attempt with the empty config file this should most
probably not work. To create a new default config file, the best way is to
delete the old and start gGo again. I guess the hang you had was some other
problem, which exactly is difficult to tell now.


> Any Suggestions?

Remove/backup your existing .ggorc file, start gGo via the script, and do a
'tail -f ~/.ggo.log' in another xterm. If anything strange appears there
(however, there is a lot of output, maybe difficult to differ the debug 
from
errors without having written the thing oneself), mail me the logfile. That
helps me most to identify an error.

> By the way gGo looks great, runs great, feels great. This IS the CLIENT
> that I've liked to make.

Thanks :)

So I suppose you somehow got some configuration working. However, it 
shouldnt be
a problem normally, and _you_ seem to know how to fix things, but not 
everyone
does and would have given up already.

 Peter

PS: Note to Stuarts reply: I tested copying the .ggorc file from Linux to
Windows and vice versa, I had no problem with that. But I dont do that 
normally,
because the window size setup differs.


Other related posts: