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

Backport "Avoid infinite loop in AbstractResource#contentLength" [SPR-9163] #13801

spring-projects-issues opened this issue Feb 24, 2012 · 1 comment


Copy link

@spring-projects-issues spring-projects-issues commented Feb 24, 2012

Chris Beams opened SPR-9163 and commented

This issue is a backport sub-task of #13799

Referenced from: commits 40a6769

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 24, 2012

Chris Beams commented

commit 40a6769309dfcc32e93072769fba2a46dd0e6a0f (HEAD, springsource/3.1.x, 3.1.x)
Author: Chris Beams <>
Date:   Fri Feb 24 14:29:28 2012 +0100

    Avoid infinite loop in AbstractResource#contentLength
    Due to changes made in commit 2fa87a71 for SPR-9118,
    AbstractResource#contentLength would fall into an infinite loop unless
    the method were overridden by a subclass (which it is in the majority of
    use cases).
    This commit:
     - fixes the infinite recursion by refactoring to a while loop
     - asserts that the value returned from #getInputStream is not null in
       order to avoid NullPointerException
     - tests both of the above
     - adds Javadoc to the Resource interface to clearly document that the
       contract for any implementation is that #getInputStream must not
       return null
    Issue: SPR-9163
    Backport-Issue: SPR-9161
    Backport-Commit: 7ca5fba05ff0ef4dcf076303e1cba19c4b771d94

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

Successfully merging a pull request may close this issue.

None yet
1 participant