Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReflectionTestUtils should defensively invoke toString() on target objects [SPR-14363] #18935

Closed
spring-projects-issues opened this issue Jun 14, 2016 · 1 comment

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 14, 2016

Sam Brannen opened SPR-14363 and commented

Status Quo

ReflectionTestUtils invokes toString() on target objects in order to create messages for exceptions and logging; however, as discussed in #14205, this practice can lead to problems if the invocation of toString() throws an exception.

The upgrade to Gradle 2.14 in #18934 made it apparent that ReflectionTestUtils.setField() in fact fails with an exception if the log level for ReflectionTestUtils is set to DEBUG. A quick inspection of the rest of the code in ReflectionTestUtils reveals that all other methods would fail in a similar fashion.

Deliverables

  1. Ensure that all invocations of toString() on target objects within ReflectionTestUtils are performed defensively (i.e., by catching any exceptions).

Affects: 3.2.17

Issue Links:

  • #14205 ReflectionTestUtils.setField() should not call toString() on the target
  • #18934 Upgrade build to Gradle 2.14.1

Referenced from: commits 045ee52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants