Commons Configuration
  1. Commons Configuration
  2. CONFIGURATION-82

[configuration] ServletRequestConfiguration getList null pointer exception

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      There seems to be a problem when retrieving a list from the
      ServletRequestConfiguration. This apears to be because the getProperty() uses
      getPrarameter(key) rather than getParameterValues(). I suggest the method
      should look something like (limited testing show that this works):

      public Object getProperty(String key)
      {
      String[] props = request.getParameterValues(key);
      Object result;
      List results;

      if (props != null)

      { result = null; }

      else if ( props.length > 1 )

      { results = Arrays.asList(props); result = results; }

      else

      { result = props[0]; }

      return result;
      }

        Activity

        Hide
        Emmanuel Bourg added a comment -

        Yes good idea, I'll integrate it.

        Show
        Emmanuel Bourg added a comment - Yes good idea, I'll integrate it.
        Hide
        Emmanuel Bourg added a comment -

        I applied your suggestion, thank you Justin. I changed the other web
        configurations to handle lists as well.

        Show
        Emmanuel Bourg added a comment - I applied your suggestion, thank you Justin. I changed the other web configurations to handle lists as well.

          People

          • Assignee:
            Unassigned
            Reporter:
            Justin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development