#37 Saving and Restoring windows does not work


1.) Start Venice, add a Portfolio, check "Redisplay Saved Windows at Start Up" in Application Preferences - User Interface
2.) Exit Venice
3.) Restart

This results in
[java] java.lang.AssertionError
[java] at nz.org.venice.ui.PrimaryProgressDialog.setProgress(PrimaryProgressDialog.java:262)
[java] at nz.org.venice.ui.SecondaryProgressDialog.setProgress(SecondaryProgressDialog.java:166)
[java] at nz.org.venice.ui.SecondaryProgressDialog.increment(SecondaryProgressDialog.java:173)
[java] at nz.org.venice.quote.FileQuoteSource.createIndex(FileQuoteSource.java:243)
[java] at nz.org.venice.quote.FileQuoteSource.checkFiles(FileQuoteSource.java:174)
[java] at nz.org.venice.quote.FileQuoteSource.getLastDate(FileQuoteSource.java:315)
[java] at nz.org.venice.prefs.settings.PortfolioModuleSettings.getModule(PortfolioModuleSettings.java:127)
[java] at nz.org.venice.main.Main.restoreSavedFrames(Main.java:304)
[java] at nz.org.venice.main.Main.<init>(Main.java:162)
[java] at nz.org.venice.main.Main.main(Main.java:203)

I'll try to fix it

Kind regards



  • cbrom

    cbrom - 2011-06-14

    The error occurs for example if you use the internal sample data. fileURLs.size() in createIndex(), module FileQuoteSource returns 43.

    That value is the progressBar's maximum set in setMaximum(int maximum) of PrimaryProgessDialog.java. The following for loop iterates to fileUrls. In that loop the ProgressDialog is incremented. The assertion
    in PrimaryDialog.setProgress(int progress) is raised, because progress gets value 44 and getMaximum() is 43.

    This is an interesting effect because calling

    ProgressDialog progress = ProgressDialogManager.getProgressDialog();

    and then

    progress.show("Some String");

    changes the value if we have another ProgressDialog visible. In the last case the show method uses the value of the other dialog.

    Like in most other classes that uses ProgressDialog (e.g. ImportQuoteModule) we should use setProgress(0) to resize.

    A reimplementation of ProgressDialog and its classes without side effects should be done.

    Second best would be to remove just assertion in setProgress(int progress) because it's not necessary: The method progressBar.setValue(getProgess()) calls JProgressBar.setValue() that uses BoundedRangeModel. BoundedRangeModel checks keeping the bounds itself and adjusts the value if necessary. So the progessbar is painted anyway.

    Another solution would be that we check keeping the bounds in methods setValue(). But this would blast the code and I think it's the wrong place.

  • Mark Hummel

    Mark Hummel - 2011-10-14

    Fixed in latest release 0.731 beta.

  • Mark Hummel

    Mark Hummel - 2011-10-14
    • status: open --> closed
  • Mark Hummel

    Mark Hummel - 2012-02-26
    • status: closed --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks