Shindig
  1. Shindig
  2. SHINDIG-1736

JsonUtil throws IllegalArgumentException if the class it is parsing has any duplicate methods

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.0-beta1
    • Fix Version/s: 2.5.0-beta1
    • Component/s: Java
    • Labels:
      None

      Description

      JsonUtil throws

      java.lang.IllegalArgumentException: duplicate key: value

      if the class it is parsing has duplicate methods caused by synthetic methods creating for generics. For example:

      private class DuplicateBase<type> {
      public type getValue()

      { return null; }

      }

      private class Duplicate extends DuplicateBase<String> {
      public String getValue()

      { return "duplicate"; }

      }

      If the Duplicate Class is parsed by JsonUtil is will blow up.

      This was introduced by revision 1290973. Before that it did not use the guava collection and have this problem.

        Activity

        Hide
        jiraposter@reviews.apache.org added a comment -

        -----------------------------------------------------------
        This is an automatically generated e-mail. To reply, visit:
        https://reviews.apache.org/r/4366/
        -----------------------------------------------------------

        Review request for shindig and Paul Lindner.

        Summary
        -------

        This is a fix for SHINDIG-1736. Currently the recently updated JsonUtil blows up if the class it is trying to parse has synthetic methods generated by the compiler for handling runtime generics substitution. It now checks to make sure the method is not synthetic. I've included a unit test that tests this scenario.

        This addresses bug SHINDIG-1736.
        https://issues.apache.org/jira/browse/SHINDIG-1736

        Diffs


        /trunk/java/common/src/main/java/org/apache/shindig/common/JsonUtil.java 1299867
        /trunk/java/common/src/test/java/org/apache/shindig/common/JsonUtilTest.java 1299867

        Diff: https://reviews.apache.org/r/4366/diff

        Testing
        -------

        unit test provided

        Thanks,

        Doug

        Show
        jiraposter@reviews.apache.org added a comment - ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/4366/ ----------------------------------------------------------- Review request for shindig and Paul Lindner. Summary ------- This is a fix for SHINDIG-1736 . Currently the recently updated JsonUtil blows up if the class it is trying to parse has synthetic methods generated by the compiler for handling runtime generics substitution. It now checks to make sure the method is not synthetic. I've included a unit test that tests this scenario. This addresses bug SHINDIG-1736 . https://issues.apache.org/jira/browse/SHINDIG-1736 Diffs /trunk/java/common/src/main/java/org/apache/shindig/common/JsonUtil.java 1299867 /trunk/java/common/src/test/java/org/apache/shindig/common/JsonUtilTest.java 1299867 Diff: https://reviews.apache.org/r/4366/diff Testing ------- unit test provided Thanks, Doug
        Hide
        jiraposter@reviews.apache.org added a comment -

        -----------------------------------------------------------
        This is an automatically generated e-mail. To reply, visit:
        https://reviews.apache.org/r/4366/#review6070
        -----------------------------------------------------------

        Ship it!

        LGTM

        • Ryan

        On 2012-03-15 17:47:31, Doug Davies wrote:

        -----------------------------------------------------------

        This is an automatically generated e-mail. To reply, visit:

        https://reviews.apache.org/r/4366/

        -----------------------------------------------------------

        (Updated 2012-03-15 17:47:31)

        Review request for shindig and Paul Lindner.

        Summary

        -------

        This is a fix for SHINDIG-1736. Currently the recently updated JsonUtil blows up if the class it is trying to parse has synthetic methods generated by the compiler for handling runtime generics substitution. It now checks to make sure the method is not synthetic. I've included a unit test that tests this scenario.

        This addresses bug SHINDIG-1736.

        https://issues.apache.org/jira/browse/SHINDIG-1736

        Diffs

        -----

        /trunk/java/common/src/main/java/org/apache/shindig/common/JsonUtil.java 1299867

        /trunk/java/common/src/test/java/org/apache/shindig/common/JsonUtilTest.java 1299867

        Diff: https://reviews.apache.org/r/4366/diff

        Testing

        -------

        unit test provided

        Thanks,

        Doug

        Show
        jiraposter@reviews.apache.org added a comment - ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/4366/#review6070 ----------------------------------------------------------- Ship it! LGTM Ryan On 2012-03-15 17:47:31, Doug Davies wrote: ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/4366/ ----------------------------------------------------------- (Updated 2012-03-15 17:47:31) Review request for shindig and Paul Lindner. Summary ------- This is a fix for SHINDIG-1736 . Currently the recently updated JsonUtil blows up if the class it is trying to parse has synthetic methods generated by the compiler for handling runtime generics substitution. It now checks to make sure the method is not synthetic. I've included a unit test that tests this scenario. This addresses bug SHINDIG-1736 . https://issues.apache.org/jira/browse/SHINDIG-1736 Diffs ----- /trunk/java/common/src/main/java/org/apache/shindig/common/JsonUtil.java 1299867 /trunk/java/common/src/test/java/org/apache/shindig/common/JsonUtilTest.java 1299867 Diff: https://reviews.apache.org/r/4366/diff Testing ------- unit test provided Thanks, Doug
        Hide
        Doug Davies added a comment -

        I'd love for Paul to review as well before shipping since he refactored this code (or at least was the committer). Also, how does this get picked up by someone that can commit? Do I need to do anything? Thanks.

        Show
        Doug Davies added a comment - I'd love for Paul to review as well before shipping since he refactored this code (or at least was the committer). Also, how does this get picked up by someone that can commit? Do I need to do anything? Thanks.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development