Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17397

LogFormatUtils.formatValue does not leniently handle toString() exceptions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 5.1.1
    • Fix Version/s: 5.1.2
    • Component/s: Core
    • Labels:
    • Last commented by a User:
      true

      Description

      Steps to reproduce:

      1. create two entities with a JPA-one-to-many-relationship between the two
      2. annotate both classes with lombok's @Data (generating e.g. toString())
      3. set logging.level.org.springframework.web to DEBUG
      4. POST a new child object with a parent reference
      5. Spot the exception. In my case, backend state was correct, frontend stopped working.

      Lombok's autogenerated toString() methods probably result in an endless loop in this call:

      https://github.com/spring-projects/spring-framework/blob/fdaceeb6c97ae166a9c09f00678383b266dfe2e3/spring-core/src/main/java/org/springframework/core/log/LogFormatUtils.java#L50

      Besides excluding some fields from being toStringified() by lombok, this method probably shouldn't throw an error in any case so you might consider try-catching the call.

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            springbob Hans
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 37 weeks ago