Spring Data MongoDB
  1. Spring Data MongoDB
  2. DATAMONGO-461

MappedConstructor potentially throws NullPointerException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.0.2
    • Component/s: Mapping
    • Labels:
      None

      Description

      The constructor of MappedConstructor accesses the PersistentEntity constructor unguarded to iterate over it's parameters. This results in a NullPointerException. Generally instantiating a MappedConstructor with a PersistentEntity not owning a PersistenceConstructor is invalid as this essentially means we have an ambiguity in constructors (multiple constructors taking arguments without one explicitly selected through @PersistenceConstructor. This indicates the class currently inspected actually either needs to be mapped correctly or a custom converter applied when reading. Thus we should reject the PersistentEntity throwing a MappingException indicating potential ways to solve the problem.

        Activity

        Hide
        Oliver Gierke added a comment -

        Fixed in 1.0.x branch (does not appear to be a problem in 1.1.x branch as the instantiation model has changed there) and deployed to snaphsot repository.

        Show
        Oliver Gierke added a comment - Fixed in 1.0.x branch (does not appear to be a problem in 1.1.x branch as the instantiation model has changed there) and deployed to snaphsot repository.

          People

          • Assignee:
            Oliver Gierke
            Reporter:
            Oliver Gierke
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: