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

AbstractApplicationContext.isRunning throws IllegalStateException when called too early

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.2.15, 4.1.7
    • Fix Version/s: 3.2.16, 4.1.9, 4.2.3
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      AbstractApplicationContext's implementation of isRunning() looks like this:

       public boolean isRunning() {
            return this.getLifecycleProcessor().isRunning();
       }
      

      If this method is called before the lifecycle processor has been initialized, an IllegalStateException is thrown.

      It seems like the correct behavior here would be to return "false" if the lifecycle processor hasn't been initialized. If the lifecycle processor is uninitialized, the answer to the question "are you running" is "no", not "illegal state".

        Activity

        Hide
        juergen.hoeller Juergen Hoeller added a comment - - edited

        Good point - fixed for 4.2.3 now, and to be backported to 4.1.9 and 3.2.16.

        Juergen

        Show
        juergen.hoeller Juergen Hoeller added a comment - - edited Good point - fixed for 4.2.3 now, and to be backported to 4.1.9 and 3.2.16. Juergen

          People

          • Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            dhay David Hay
            Last updater:
            Juergen Hoeller
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 15 weeks, 3 days ago