Apache Roller
  1. Apache Roller
  2. ROL-1930

Saving Template causes Null Pointer Exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 5.1
    • Fix Version/s: 5.1
    • Labels:
      None

      Description

      Steps to reproduce:
      1) Upgrade from Roller 5.0 to Roller 5.1 via normal upgrade process
      2) Login and edit one of your templates
      3) Save your template and you'll get an error, if you look in the logs you will see that it is a Null Pointer Exception

      This is caused because the Template does not have a "Template Code" object associated with it yet.

      One possible way to fix this is: if a template code object is not found, then create a new one.

        Activity

        Hide
        David Johnson added a comment - - edited

        This was originally a fix for "Saving Template causes Null Pointer Exception"
        URL: http://svn.apache.org/viewvc?rev=1201435&view=rev

        But... once I fixed the problem I found a series of other problems and ended up making some fundamental changes in the way that Roller's new mobile template support is implemented. I will summarize.

        1) The Template Edit page now uses the YUI tab control to switch between a Page's standard and mobile template code on the client side. Both values are saved on the client-side and switching tabs no longer causes a page refresh.

        2) This is the big change: Instead of determining the device-type and then injecting the right template code into the Roller Page object, which could cause other requests to get the wrong data inside the Page object, we now determine the device type and pass it down deep into Roller's rendering engine. At the RollerResourceLoader level we use the deviceType to fetch the correct template code for the deviceType.

        3) What we called "type" in many places is now an enum called DeviceType and the variable is called deviceType instead of "type" everywhere.

        Show
        David Johnson added a comment - - edited This was originally a fix for "Saving Template causes Null Pointer Exception" URL: http://svn.apache.org/viewvc?rev=1201435&view=rev But... once I fixed the problem I found a series of other problems and ended up making some fundamental changes in the way that Roller's new mobile template support is implemented. I will summarize. 1) The Template Edit page now uses the YUI tab control to switch between a Page's standard and mobile template code on the client side. Both values are saved on the client-side and switching tabs no longer causes a page refresh. 2) This is the big change: Instead of determining the device-type and then injecting the right template code into the Roller Page object, which could cause other requests to get the wrong data inside the Page object, we now determine the device type and pass it down deep into Roller's rendering engine. At the RollerResourceLoader level we use the deviceType to fetch the correct template code for the deviceType. 3) What we called "type" in many places is now an enum called DeviceType and the variable is called deviceType instead of "type" everywhere.

          People

          • Assignee:
            David Johnson
            Reporter:
            David Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development