Skip to content

Commit

Permalink
[fix] Don't let getSession cause an infinite loop if it throws Illega…
Browse files Browse the repository at this point in the history
…lStateException (#216)
  • Loading branch information
smellsblue committed Dec 3, 2020
1 parent 5854db8 commit b2c7cab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/ruby/jruby/rack/session_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ def get_servlet_session(env, create = false)
unless servlet_request = env['java.servlet_request']
raise "JavaServletStore expects a servlet request at env['java.servlet_request']"
end
servlet_session = servlet_request.getSession(create)
servlet_session =
begin
servlet_request.getSession(create)
rescue java.lang.IllegalStateException => e
raise "Failed to obtain session due to IllegalStateException: #{e.message}"
end
env[ENV_SERVLET_SESSION_KEY] = servlet_session
end
rescue java.lang.IllegalStateException # cached session invalidated
Expand Down

0 comments on commit b2c7cab

Please sign in to comment.