[JME 2.X] com.jme.system.PreferencesGameSettings is broken? [SOLVED]

Until recently my application worked well with preferences settings stored in my Windows registry.

Code I use:

public class Main {

    public static final Preferences oracleMonitorPreferences = Preferences.userRoot().node("Oracle 3D Monitor");

    public static PreferencesGameSettings oracleMonitorSettings;

    public static void main(final String[] args) {
        // 1/ set preferences (framerate in windows registry)

        // 2/ initialize "game"
        final StandardGame oracleMonitor = new StandardGame("Oracle 3D Monitor", StandardGame.GameType.GRAPHICAL, oracleMonitorSettings);
        // initialize the background color
        oracleMonitor.start();   // Start the game thread

        // Apply state
        final OracleMonitorGameState state = new OracleMonitorGameState();


     * Set preferences regarding the display like the framerate, the widht, the height of the window...
     * Under windows, preferences are stored in the registry under:
     * HKEY_CURRENT_USERSoftwareJavaSoftPrefs
    private static void setPreferences() {
        try {
            oracleMonitorPreferences.put("GameFramerate", "63");
            oracleMonitorPreferences.put("GameFullscreen", "true");
            oracleMonitorPreferences.put("GameWidth", "640");
            oracleMonitorPreferences.put("GameHeight", "480");
            oracleMonitorPreferences.put("GameDepthBits", "24");
        catch (BackingStoreException bse) {

        oracleMonitorSettings = new PreferencesGameSettings(oracleMonitorPreferences);

It worked pretty well but now I get the following error:

18 juin 2008 22:46:32 com.jmex.game.DefaultUncaughtExceptionHandler uncaughtException
GRAVE: Main game loop broken by uncaught exception
   at com.jme.system.PreferencesGameSettings.getDepthBits(PreferencesGameSettings.java:159)
   at com.jmex.game.StandardGame.displayMins(StandardGame.java:311)
   at com.jmex.game.StandardGame.initSystem(StandardGame.java:262)
   at com.jmex.game.StandardGame.run(StandardGame.java:184)
   at java.lang.Thread.run(Thread.java:619)

I presume, someting related to the changes made in version 3854 of file com.jme.system.PreferencesGameSettings. In fact the NullPointerException comes from Java 5 auto-boxing because com.jme.system.AbstractGameSettings#defaultDepthBits is not initialized (in brief is equal to null).

Maybe I'm misusing these classes, can someone help me?



I noticed that too, havn't figured it out yet.

YES! Hopefully, it was not too hard to solve, in fact, the following contructor of PreferencesGameSettings is wrong:

    public PreferencesGameSettings(Preferences preferences) {
        this.preferences = preferences;

it should be:

    public PreferencesGameSettings(Preferences preferences) {

Now it works as before  :D

Defect number 2 added.

Thanks, saved me some time!

This is fixed, thanks for submitting it.