Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7941

MissingMethodException should limit argument types in getMessage()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.4.7
    • 2.5.0-alpha-1
    • groovy-jdk
    • None
    • All Environments

    Description

      The getMessage() method in MissingMethodException uses InvokerHelper.toTypeString(Object[] arguments) to generate the types of each argument. When this exception occurs with a large parameter list this can create a very large String. The format method which is used 2 lines later to print the values uses a 40 character limit, I'd like to propose to use similar logic for the types as well.

      Here is a trivial code snippet from groovysh - this log message can grow unbounded:

      groovy:000> missing(*("Test".getBytes()))
      ERROR groovy.lang.MissingMethodException:
      No signature of method: groovysh_evaluate.missing() is applicable for argument types: (java.lang.Byte, java.lang.Byte, java.lang.Byte, java.lang.Byte) values: [84, 101, 115, 116]
      Possible solutions: toString(), toString()
      

      Attachments

        1. add_missing_method_limit.patch
          3 kB
          Vlad Shtibin

        Issue Links

          Activity

            People

              paulk Paul King
              vl4d Vlad Shtibin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: