glassfish
  1. glassfish
  2. GLASSFISH-3926

Bad error reporting in MetaData.initialize() (possible NPE)

    Details

    • Issuezilla Id:
      3,926

      Description

      The method "initialize" tries to assign "data"

      private static void initialize(){
      ...
      SunWebAppData data = null;
      try

      { data = SunWebAppData.createGraph(in); }

      catch (Schema2BeansException e)

      { System.out.println("Failed to create bean graph for SunWebAppData"); //NOI18N }

      //System.out.println("############ " + data.dumpBeanNode()); //NOI18N
      ParamData pData = null;

      // initialize all param name arrays
      sessionParamName = new String[data.sizeSessionParam()];
      storeParamName = new String[data.sizeStoreParam()];
      managerParamName = new String[data.sizeManagerParam()];
      ...

      if this fails then "data" is null, however, immediatly below this assignment
      (as seen in the snippet above) "data" is unconditionally dereferenced many
      times.

      I think this catch block needs to be fixed to throw an IllegalStateException or
      some other semantic exception explaining the problem. This would be much more
      fail-fast than it currently is. For example,

      try

      { data = SunWebAppData.createGraph(in); }

      catch (Schema2BeansException e)

      { throw new IllegalStateException("Failed to create bean graph for SunWebAppData"); //NOI18N }

        Activity

        Hide
        harpreet added a comment -

        Not critical for v2.1 should be fixed for next release

        Show
        harpreet added a comment - Not critical for v2.1 should be fixed for next release
        Hide
        sanandal added a comment -

        "Reclassifying as P4 because this issue is not deemed "must fix" for this v2.1
        release whose primary release driver is SailFin.
        This issue will be scrubbed after this release and will be given the right
        priority for the next release."

        Show
        sanandal added a comment - "Reclassifying as P4 because this issue is not deemed "must fix" for this v2.1 release whose primary release driver is SailFin. This issue will be scrubbed after this release and will be given the right priority for the next release."

          People

          • Assignee:
            Dhiru Pandey
            Reporter:
            hallorant
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: