Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6364

Map2Bean doesn't fail with wrong generic type

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 5.4.3
    • 5.4.1
    • None
    • None
    • Basel 12
    • 8

    Description

      Given the following *wrong* YAML fragment for a sample AvailabilityDefinition:

      availability:
        nodeTypes:
          - mgnl-folder: mgnl:folder 
      

      * The above is wrong because nodeTypes expects a list of strings, not maps.

      When Map2BeanTransformer processes the "erroneous" YAML, It wrongly creates a collection containing maps, regardless of the generic type in the bean method signature.
      Therefore, iterating over this collection will throw a ClassCastException.

      Map2Bean should ignore entries which don't match the bean method's generic type, and warn accordingly.


      See also

      AvailabilityDefinition.java
      Collection<String> getNodeTypes()
      


      Side note #1:
      The issue arose with a wrong YAML app descriptor, which was produced by the Download as YAML action.
      See the corresponding JCR bootstrap file on git.

      Side note #2:
      Correct YAML fragment would be:

      availability:
        nodeTypes:
          - mgnl:product
      

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                trang.truong Trang Truong
                cmeier Christoph Meier
                Votes:
                1 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD

                    Time Tracking

                      Estimated:
                      Original Estimate - 4.5h Original Estimate - 4.5h
                      4.5h
                      Remaining:
                      Remaining Estimate - 0d
                      0d
                      Logged:
                      Time Spent - 10d 7.5h
                      10d 7.5h