#98 AbstractChartDefinition's serialization is broken

closed-fixed
nobody
TagLibrary (33)
5
2010-07-16
2007-06-19
No

The class de.laures.cewolf.taglib.AbstractChartDefinition implements the Serializable Interface. However, it has two fields marked as transient which should not be transient, namely 'postProcessors' and 'chart'.

These fields may be uninitialized after deserialization but are not checked before use which may lead to a NullPointerException!

The 'chart' field is of type JFreeChart which is serializable thus removing the transient-keyword should be enough.

The 'postProcessors' fields is a list of ChartPostProcessors which need not to be serializable which is a problem. I can't see an easy way of solving this problem without touching other classes as well. My workaround is to check before every access so that no NPE is thrown and immediately return null. The caller has to check the result and handle this.

Discussion

  • Ulf Dittmer

    Ulf Dittmer - 2008-03-01

    Logged In: YES
    user_id=908396
    Originator: NO

    I've put up a version of cewolf that fixes this bug (and a few others) at http://www.ulfdittmer.com/code/cewolf.html.

    The fix introduces an incompatibility to previous versions, though: ChartPostProcessor implementations need to be adapted, but in most cases the change is an easy one.

     
  • Ulf Dittmer

    Ulf Dittmer - 2010-07-16

    Fixed in version 1.1

     
  • Ulf Dittmer

    Ulf Dittmer - 2010-07-16
    • status: open --> closed-fixed
     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks