DO NOT REPLY [Bug 48046] New: wrong implementation of peek() method of JIoEndpoint.WorkerStack class
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...@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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
DO NOT REPLY [Bug 48047] New: Http11Protocol.Http11ConnectionHandler's process(Socket socket) method always return false!
https://issues.apache.org/bugzilla/show_bug.cgi?id=48047 Summary: Http11Protocol.Http11ConnectionHandler's process(Socket socket) method always return false! Product: Tomcat 6 Version: 6.0.20 Platform: PC OS/Version: All Status: NEW Severity: major Priority: P2 Component: Connectors AssignedTo: dev@tomcat.apache.org ReportedBy: qingyang...@qunar.com Below is the source code of process() method: public boolean process(Socket socket) { Http11Processor processor = recycledProcessors.poll(); try { if (processor == null) { processor = createProcessor(); } if (processor instanceof ActionHook) { ((ActionHook) processor).action(ActionCode.ACTION_START, null); } if (proto.secure && (proto.sslImplementation != null)) { processor.setSSLSupport (proto.sslImplementation.getSSLSupport(socket)); } else { processor.setSSLSupport(null); } processor.process(socket); return false; } catch(java.net.SocketException e) { // SocketExceptions are normal Http11Protocol.log.debug (sm.getString ("http11protocol.proto.socketexception.debug"), e); } catch (java.io.IOException e) { // IOExceptions are normal Http11Protocol.log.debug (sm.getString ("http11protocol.proto.ioexception.debug"), e); } // Future developers: if you discover any other // rare-but-nonfatal exceptions, catch them here, and log as // above. catch (Throwable e) { // any other exception or error is odd. Here we log it // with "ERROR" level, so it will show up even on // less-than-verbose logs. Http11Protocol.log.error (sm.getString("http11protocol.proto.error"), e); } finally { // if(proto.adapter != null) proto.adapter.recycle(); //processor.recycle(); if (processor instanceof ActionHook) { ((ActionHook) processor).action(ActionCode.ACTION_STOP, null); } recycledProcessors.offer(processor); } return false; } It is easy to find out that the method always return the boolean value of 'false', which is pointless. It seems that it should return 'true' when process successfully, as such: try { ... ... processor.process(socket); return true; } catch(...) -- 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r829440 - in /tomcat/trunk/java/org/apache/catalina/startup: ContextConfig.java LocalStrings.properties WebXml.java
Author: markt Date: Sat Oct 24 20:07:42 2009 New Revision: 829440 URL: http://svn.apache.org/viewvc?rev=829440&view=rev Log: Implement merge rules for a few more web.xml elements Required some refactoring as some of the rules depend on all fragments and the main web.xml Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties tomcat/trunk/java/org/apache/catalina/startup/WebXml.java Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=829440&r1=829439&r2=829440&view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Sat Oct 24 20:07:42 2009 @@ -1215,6 +1215,7 @@ */ protected void webConfig() { WebXml webXml = new WebXml(); + // Parse global web.xml if present InputSource globalWebXml = getGlobalWebXmlSource(); if (globalWebXml == null) { @@ -1242,14 +1243,14 @@ // Merge the fragments into the main web.xml mergeWebFragments(webXml, fragments); -// Apply merged web.xml to Context -webXml.configureContext(context); - // Process JARs for annotations processAnnotationsInJars(fragments); // Process /WEB-INF/classes for annotations // TODO SERVLET3 + +// Apply merged web.xml to Context +webXml.configureContext(context); } else { // Apply merged web.xml to Context webXml.configureContext(context); @@ -1601,18 +1602,9 @@ // TODO SERVLET3 Relative ordering } -// Merge fragments in order - conflict == error -WebXml mergedFragments = new WebXml(); -for (WebXml fragment : orderedFragments) { -ok = mergedFragments.merge(fragment, false); -if (ok == false) { -break; -} -} - -// Merge fragment into application - conflict == application wins +// Merge fragment into application if (ok) { -ok = application.merge(mergedFragments, true); +ok = application.merge(orderedFragments); } } Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=829440&r1=829439&r2=829440&view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Sat Oct 24 20:07:42 2009 @@ -114,5 +114,8 @@ webXml.duplicateResourceEnvRef=Duplicate resource-env-ref name webXml.duplicateResourceRef=Duplicate resource-ref name webXml.reservedName=A web.xml file was detected using a reserved name [{0}]. The name element will be ignored for this fragment. +webXml.mergeConflictContextParam=Context parameter [{0}] was defined in multiple fragments with different values including fragment with name [{1}] located at [{2}] +webXml.mergeConflictDisplayName=The display name was defined in multiple fragments with different values including fragment with name [{0}] located at [{1}] +webXml.mergeConflictEjbLocalRef=The EjbLocalRef [{0}] was defined in multiple fragments including fragment with name [{1}] located at [{2}] webXml.mergeConflictListener=Listener [{0}] was defined in multiple fragments including fragment with name [{1}] located at [{2}] webXml.multipleOther=Multiple others entries in ordering Modified: tomcat/trunk/java/org/apache/catalina/startup/WebXml.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/WebXml.java?rev=829440&r1=829439&r2=829440&view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/WebXml.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/WebXml.java Sat Oct 24 20:07:42 2009 @@ -323,11 +323,14 @@ // ejb-local-ref // TODO: Should support multiple description elements with language -private Set ejbLocalRefs = new HashSet(); +private Map ejbLocalRefs = +new HashMap(); public void addEjbLocalRef(ContextLocalEjb ejbLocalRef) { -ejbLocalRefs.add(ejbLocalRef); +ejbLocalRefs.put(ejbLocalRef.getName(),ejbLocalRef); +} +public Map getEjbLocalRefs() { +return ejbLocalRefs; } -public Set getEjbLocalRefs() { return ejbLocalRefs; } // service-ref // TODO: Should support multiple description elements
svn commit: r829448 - in /tomcat/trunk/java/org/apache/catalina: deploy/ErrorPage.java startup/LocalStrings.properties startup/WebXml.java
Author: markt Date: Sat Oct 24 20:52:46 2009 New Revision: 829448 URL: http://svn.apache.org/viewvc?rev=829448&view=rev Log: Merge code for a few more elements Modified: tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties tomcat/trunk/java/org/apache/catalina/startup/WebXml.java Modified: tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java?rev=829448&r1=829447&r2=829448&view=diff == --- tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java (original) +++ tomcat/trunk/java/org/apache/catalina/deploy/ErrorPage.java Sat Oct 24 20:52:46 2009 @@ -167,5 +167,12 @@ } +public String getName() { +if (exceptionType == null) { +return Integer.toString(errorCode); +} else { +return exceptionType; +} +} } Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=829448&r1=829447&r2=829448&view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Sat Oct 24 20:52:46 2009 @@ -117,5 +117,8 @@ webXml.mergeConflictContextParam=Context parameter [{0}] was defined in multiple fragments with different values including fragment with name [{1}] located at [{2}] webXml.mergeConflictDisplayName=The display name was defined in multiple fragments with different values including fragment with name [{0}] located at [{1}] webXml.mergeConflictEjbLocalRef=The EjbLocalRef [{0}] was defined in multiple fragments including fragment with name [{1}] located at [{2}] +webXml.mergeConflictEjbRef=The EjbRef [{0}] was defined in multiple fragments including fragment with name [{1}] located at [{2}] +webXml.mergeConflictEnvEntry=The Environment entry [{0}] was defined in multiple fragments including fragment with name [{1}] located at [{2}] +webXml.mergeConflictErrorPage=The Error Page for [{0}] was defined in multiple fragments including fragment with name [{1}] located at [{2}] webXml.mergeConflictListener=Listener [{0}] was defined in multiple fragments including fragment with name [{1}] located at [{2}] webXml.multipleOther=Multiple others entries in ordering Modified: tomcat/trunk/java/org/apache/catalina/startup/WebXml.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/WebXml.java?rev=829448&r1=829447&r2=829448&view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/WebXml.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/WebXml.java Sat Oct 24 20:52:46 2009 @@ -249,11 +249,11 @@ } // error-page -private Set errorPages = new HashSet(); +private Map errorPages = new HashMap(); public void addErrorPage(ErrorPage errorPage) { -errorPages.add(errorPage); +errorPages.put(errorPage.getName(), errorPage); } -public Set getErrorPages() { return errorPages; } +public Map getErrorPages() { return errorPages; } // Digester will check there is only one jsp-config // jsp-config/taglib or taglib (2.3 and earlier) @@ -317,9 +317,11 @@ // ejb-ref // TODO: Should support multiple description elements with language -private Set ejbRefs = new HashSet(); -public void addEjbRef(ContextEjb ejbRef) { ejbRefs.add(ejbRef); } -public Set getEjbRefs() { return ejbRefs; } +private Map ejbRefs = new HashMap(); +public void addEjbRef(ContextEjb ejbRef) { +ejbRefs.put(ejbRef.getName(),ejbRef); +} +public Map getEjbRefs() { return ejbRefs; } // ejb-local-ref // TODO: Should support multiple description elements with language @@ -454,13 +456,13 @@ for (ContextLocalEjb ejbLocalRef : ejbLocalRefs.values()) { context.getNamingResources().addLocalEjb(ejbLocalRef); } -for (ContextEjb ejbRef : ejbRefs) { +for (ContextEjb ejbRef : ejbRefs.values()) { context.getNamingResources().addEjb(ejbRef); } for (ContextEnvironment environment : envEntries.values()) { context.getNamingResources().addEnvironment(environment); } -for (ErrorPage errorPage : errorPages) { +for (ErrorPage errorPage : errorPages.values()) { context.addErrorPage(errorPage); } for (FilterDef filter : filters.values()) { @@ -574,6 +576,8 @@ // Merge rules vary from element to element. See SRV.8.2.3 WebXml temp
svn commit: r829449 - in /tomcat/trunk/webapps/examples/WEB-INF/classes/async: AsyncStockServlet.java Stockticker.java
Author: markt Date: Sat Oct 24 20:54:19 2009 New Revision: 829449 URL: http://svn.apache.org/viewvc?rev=829449&view=rev Log: Fix Eclipse niggles in the examples Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java?rev=829449&r1=829448&r2=829449&view=diff == --- tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java (original) +++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java Sat Oct 24 20:54:19 2009 @@ -61,7 +61,7 @@ actx.addListener(this); resp.setContentType("text/plain"); clients.add(actx); -if (this.clientcount.incrementAndGet()==1) { +if (clientcount.incrementAndGet()==1) { ticker.addTickListener(this); } } else { Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java?rev=829449&r1=829448&r2=829449&view=diff == --- tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java (original) +++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java Sat Oct 24 20:54:19 2009 @@ -40,7 +40,7 @@ try { ticker.join(); }catch (InterruptedException x) { -ticker.interrupted(); +Thread.interrupted(); } ticker = null; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r829450 - in /tomcat/trunk/java/org/apache/coyote/http11: AbstractHttp11Processor.java Http11NioProcessor.java
Author: markt Date: Sat Oct 24 21:00:42 2009 New Revision: 829450 URL: http://svn.apache.org/viewvc?rev=829450&view=rev Log: Remove unused imports and methods Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=829450&r1=829449&r2=829450&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Sat Oct 24 21:00:42 2009 @@ -16,7 +16,6 @@ */ package org.apache.coyote.http11; -import java.net.InetAddress; import java.util.StringTokenizer; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; @@ -26,7 +25,6 @@ import org.apache.coyote.Response; import org.apache.tomcat.util.buf.Ascii; import org.apache.tomcat.util.buf.ByteChunk; -import org.apache.tomcat.util.buf.HexUtils; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.res.StringManager; Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=829450&r1=829449&r2=829450&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Sat Oct 24 21:00:42 2009 @@ -21,14 +21,10 @@ import java.io.InterruptedIOException; import java.net.InetAddress; import java.nio.channels.SelectionKey; -import java.util.StringTokenizer; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; import org.apache.coyote.ActionCode; import org.apache.coyote.ActionHook; -import org.apache.coyote.Adapter; import org.apache.coyote.Request; import org.apache.coyote.RequestInfo; import org.apache.coyote.Response; @@ -52,7 +48,6 @@ import org.apache.tomcat.util.net.SSLSupport; import org.apache.tomcat.util.net.SocketStatus; import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState; -import org.apache.tomcat.util.res.StringManager; import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment; @@ -184,67 +179,6 @@ /** - * General use method - * - * @param sArray the StringArray - * @param value string - */ -private String[] addStringArray(String sArray[], String value) { -String[] result = null; -if (sArray == null) { -result = new String[1]; -result[0] = value; -} -else { -result = new String[sArray.length + 1]; -for (int i = 0; i < sArray.length; i++) -result[i] = sArray[i]; -result[sArray.length] = value; -} -return result; -} - - -/** - * General use method - * - * @param rArray the REArray - * @param value Obj - */ -private Pattern[] addREArray(Pattern rArray[], Pattern value) { -Pattern[] result = null; -if (rArray == null) { -result = new Pattern[1]; -result[0] = value; -} -else { -result = new Pattern[rArray.length + 1]; -for (int i = 0; i < rArray.length; i++) -result[i] = rArray[i]; -result[rArray.length] = value; -} -return result; -} - - -/** - * Checks if any entry in the string array starts with the specified value - * - * @param sArray the StringArray - * @param value string - */ -private boolean startsWithStringArray(String sArray[], String value) { -if (value == null) - return false; -for (int i = 0; i < sArray.length; i++) { -if (value.startsWith(sArray[i])) { -return true; -} -} -return false; -} - -/** * Process pipelined HTTP requests using the specified input and output * streams. * - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r829451 - /tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java
Author: markt Date: Sat Oct 24 21:07:13 2009 New Revision: 829451 URL: http://svn.apache.org/viewvc?rev=829451&view=rev Log: Remove unused field Modified: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java Modified: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java?rev=829451&r1=829450&r2=829451&view=diff == --- tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DeferredFileOutputStream.java Sat Oct 24 21:07:13 2009 @@ -42,20 +42,13 @@ /** - * The output stream to which data will be written prior to the theshold + * The output stream to which data will be written prior to the threshold * being reached. */ private ByteArrayOutputStream memoryOutputStream; /** - * The output stream to which data will be written after the theshold is - * reached. - */ -private FileOutputStream diskOutputStream; - - -/** * The output stream to which data will be written at any given time. This * will always be one of memoryOutputStream or * diskOutputStream. @@ -126,7 +119,6 @@ byte[] data = memoryOutputStream.toByteArray(); FileOutputStream fos = new FileOutputStream(outputFile); fos.write(data); -diskOutputStream = fos; currentOutputStream = fos; memoryOutputStream = null; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r829452 - /tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
Author: markt Date: Sat Oct 24 21:07:44 2009 New Revision: 829452 URL: http://svn.apache.org/viewvc?rev=829452&view=rev Log: Remove unnecessary casts Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java?rev=829452&r1=829451&r2=829452&view=diff == --- tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Sat Oct 24 21:07:44 2009 @@ -32,7 +32,6 @@ import javax.management.ObjectName; import org.apache.coyote.ActionCode; -import org.apache.coyote.ActionHook; import org.apache.coyote.Adapter; import org.apache.coyote.ProtocolHandler; import org.apache.coyote.RequestGroupInfo; @@ -367,9 +366,7 @@ processor = createProcessor(); } -if (processor instanceof ActionHook) { -((ActionHook) processor).action(ActionCode.ACTION_START, null); -} +processor.action(ActionCode.ACTION_START, null); processor.process(socket.getSocket()); return false; @@ -395,9 +392,7 @@ AjpProtocol.log.error (sm.getString("ajpprotocol.proto.error"), e); } finally { -if (processor instanceof ActionHook) { -((ActionHook) processor).action(ActionCode.ACTION_STOP, null); -} +processor.action(ActionCode.ACTION_STOP, null); recycledProcessors.offer(processor); } return false; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org