Menu

getDataFile on framework context returns null

Sahoo
2012-03-11
2013-02-07
  • Sahoo

    Sahoo - 2012-03-11

    Could anyone familiar with the code tell me why getDataFile() always returns null for system bundle context? It seems out of the two constructors of BundleImpl, the one that's used by SystemBundle does not initialize bundleDir field. Is this a bug or is there a particular reason for this behavior?

    Thanks
    Sahoo

     
  • Jan Stein

    Jan Stein - 2012-03-13

    The reasons are historical, at first there were no System Bundle & Context. Then the System Bundle was introduced but not the System Bundle Context, so we didn't need to initialize the bundle data directory since it wasn't  referenced. Then came System Bundle Context, but since we didn't use the system bundle data directory, nobody noticed that it wasn't initialized.

    What do you want to use this to? Or is it just that you expect it to return an object on a system with a filesystem? It is legal to return null if we don't have file storage.

       /Jan

     
    • Sahoo

      Sahoo - 2013-02-02

      Hi,
      I don't know why I never got notified of your response. I am again trying using Knopflerfish with GlassFish. Since our launcher code can't be a bundle itself (remember it launches the framework), it uses systemBundle.getBundleContext.getDataFile to obtain a storage area to some information for use in subsequent restart.

      Sahoo

       
  • Jan Stein

    Jan Stein - 2013-02-04

    Okay, that seems to be a valid use for the System Bundle data storage. I'll put that in the next release of the framework.

    /Jan

     
  • Gunnar Ekolin

    Gunnar Ekolin - 2013-02-07

    This has now been fixed on the trunk.
    Download a snapshot build made today (or later) to test it.
    Snapshot builds are available on
    http://www.knopflerfish.org/snapshots/

     

Log in to post a comment.