Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1219

When nullable key is defined Encoder would throw NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • V2 2.0.9
    • V2 2.0.12
    • odata2-core
    • None

    Description

      in current Encoder implementation, if given input is null, an NPE would be thrown

      The scenario would be, consider an Entity which key is allowed to be null in Edmx, thus, the data retrieved in data source would be a HashMap only with non-null value, when createEntryKey<-createSelfLink, we generate the key representation from the given data, some of the key would be null and passed to Encoder, which would throw NullPointerException and skip the check of its corresponding facets

      if (value == null) {
      if (facets == null || facets.isNullable() == null || facets.isNullable())

      { return null; }

      else

      { throw new EdmSimpleTypeException(EdmSimpleTypeException.VALUE_NULL_NOT_ALLOWED); }

      }

      A pull request has been created aim to fix it at https://github.com/apache/olingo-odata2/pull/14

      Attachments

        Activity

          People

            mirbo mibo
            syhan Song Yihan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m