You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2001/09/26 19:49:43 UTC

DO NOT REPLY [Bug 3841] New: - incorrect state reported by EmbeddedManager.java:start()

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3841>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3841

incorrect state reported by EmbeddedManager.java:start()

           Summary: incorrect state reported by EmbeddedManager.java:start()
           Product: Tomcat 4
           Version: 4.0 Final
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: toby@caboteria.org


The start() method of EmbeddedManager.java reports its state incorrectly if
Embedded.java:start() throws an exception.  The "catch" block looks OK, it sets
the state to "Stopped", but the problem is that the code after the catch then
gets executed and sends an erroneous AttributeChangeNotification to the JMX
MBean Server.

The fix is to put the AttributeChangeNotification into the try{} block, so that
it won't run if an error is thrown.  Here's a patch:

Index: catalina/src/share/org/apache/catalina/startup/EmbeddedManager.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/EmbeddedManager.java,v
retrieving revision 1.3
diff -u -r1.3 EmbeddedManager.java
--- catalina/src/share/org/apache/catalina/startup/EmbeddedManager.java	2001/07/22 20:25:13	1.3
+++ catalina/src/share/org/apache/catalina/startup/EmbeddedManager.java	2001/09/26 16:19:17
@@ -192,6 +192,13 @@
 
             embedded.start();
 
+
    state = STARTED;
+
    notification = new AttributeChangeNotification
+
	(this, sequenceNumber++, System.currentTimeMillis(),
+
	 "Started " + NAME, "State", "java.lang.Integer",
+
	 new Integer(STARTING), new Integer(STARTED));
+
    sendNotification(notification);
+
         } catch (Throwable t) {
             state = STOPPED;
             notification = new AttributeChangeNotification
@@ -200,13 +207,6 @@
                  new Integer(STARTING), new Integer(STOPPED));
             sendNotification(notification);
         }
-
-        state = STARTED;
-        notification = new AttributeChangeNotification
-            (this, sequenceNumber++, System.currentTimeMillis(),
-             "Started " + NAME, "State", "java.lang.Integer",
-             new Integer(STARTING), new Integer(STARTED));
-        sendNotification(notification);
 
     }