Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6104

Modules or config framework should gracefully handle missing paths or missing properties

    Details

    • Story Points:
      5

      Description

      Currently, modules do things like

      String magnoliaHome = MagnoliaConfigurationProperties.getProperty("magnolia.home");
      configSourceFactory.yaml().from(Paths.get(magnoliaHome))
      

      If magnolia.home is not defined, this throws the ugly exception below. There are several things we could do:

      • pass a String of the path to configSourceFactory instead of a Path instance.
      • pass the name of the property, and let configSourceFactory call MagnoliaConfigurationProperties
      • add method to MagnoliaConfigurationProperties to get a Path instance from a property name (can check for existence and it being a directory)
      • add getMagnoliaHome() to MagnoliaInitPaths and make this property a first class citizen. This could also ensure that even if the property isn't defined, we fallback to app-root-dir (rather than relying on the fact that the property exists with its default value, which is indeed ${magnolia.app.rootdir}
        I would tend to favor #4, but there are perhaps more ideas (and/or combinations thereof). Let's update the title of this issue once we decide.
      [INFO] [talledLocalContainer] 2015-03-04 11:18:22,784 ERROR info.magnolia.module.ModuleManagerImpl            : Can't start module ui-framework
      [INFO] [talledLocalContainer] java.lang.NullPointerException
      [INFO] [talledLocalContainer] 	at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77)
      [INFO] [talledLocalContainer] 	at sun.nio.fs.UnixPath.<init>(UnixPath.java:71)
      [INFO] [talledLocalContainer] 	at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
      [INFO] [talledLocalContainer] 	at java.nio.file.Paths.get(Paths.java:84)
      [INFO] [talledLocalContainer] 	at info.magnolia.ui.framework.UiFrameworkModule.start(UiFrameworkModule.java:84)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                gjoseph Magnolia International
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: