tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 48046] New: wrong implementation of peek() method of JIoEndpoint.WorkerStack class
Date Sat, 24 Oct 2009 09:48:12 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=48046

           Summary: wrong implementation of peek() method of
                    JIoEndpoint.WorkerStack class
           Product: Tomcat 6
           Version: 6.0.20
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Connectors
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: qingyang.xu@qunar.com


/**
         * Get the first object out of the queue, Return null if the queue
         * is empty.
         */
        public Worker peek() {
            return workers[end];
        }


should be:

         /**
         * Get the first object out of the queue, Return null if the queue
         * is empty.
         */
        public Worker peek() {
            if (end > 0) {
                return workers[end - 1];
            }
            return null;
        }

please refer to the pop() method:

        /**
         * Get the first object out of the queue. Return null if the queue
         * is empty. 
         */
        public Worker pop() {
            if (end > 0) {
                return workers[--end];
            }
            return null;
        }

Though obviously wrong, the peek() method has not been invoked in the whole
source code base of Tomcat. But what if future version makes use of peek()
method?? So, please correct it. It is so easy.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message