[Bug 54604] New: NPE at InternalInputBuffer.java while using AsyncContext

2013-02-24 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=54604

Bug ID: 54604
   Summary: NPE at InternalInputBuffer.java while using
AsyncContext
   Product: Tomcat Connectors
   Version: unspecified
  Hardware: All
Status: NEW
  Severity: blocker
  Priority: P2
 Component: Common
  Assignee: dev@tomcat.apache.org
  Reporter: speakto...@gmail.com
Classification: Unclassified

Hi Friend,

I am getting following NPE, while I am using AsyncContext in the below
mentioned scenario.

Scenario :
I have introduced 1 sec delay inside the while loop after every readLine() call
from BufferedReader. This is causing the below error. Please note that, it is
working fine if I am not using AsyncContext with the same read delay value( 1
sec). Hence I am suspecting this problem is related to AsyncContext. 

Server side code snippet in my servlet is shown below :
...
AsyncContext ctx = request.startAsync();
BufferedReader br = new BufferedReader(new
InputStreamReader(ctx.getRequest().getInputStream()));
String line=null;

while((line= br.readLine())!=null) 
{

System.out.println(line);
Thread.sleep(1000);

}
...

Client side code snippet to send 50 MB of data in a HttpPost request
.
org.apache.commons.httpclient.HttpClient client = new
org.apache.commons.httpclient.HttpClient();

String fileName = "F:\\SampleFile_50MBData";
FileInputStream is= new FileInputStream(fileName);
PostMethod postMethod = new
PostMethod("http://localhost:8080/async-read-delay/test";);
postMethod.setRequestEntity(new InputStreamRequestEntity(is,-1));
int response = client.executeMethod(postMethod);
is.close();
.

Exception in thread "http-bio-8080-exec-2" java.lang.NullPointerException
at
org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:516)
at
org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:501)
at
org.apache.coyote.http11.InternalInputBuffer$InputStreamInputBuffer.doRead(InternalInputBuffer.java:563)
at
org.apache.coyote.http11.AbstractInputBuffer.doRead(AbstractInputBuffer.java:344)
at org.apache.coyote.Request.doRead(Request.java:422)
at
org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:290)
at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:431)
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:315)
at
org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at test.TestAsyncFilter.readContent(TestAsyncFilter.java:82)
at test.TestAsyncFilter.access$0(TestAsyncFilter.java:66)
at test.TestAsyncFilter$1.run(TestAsyncFilter.java:53)
at
org.apache.catalina.core.AsyncContextImpl$RunnableWrapper.run(AsyncContextImpl.java:474)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


Note : I have tested this in Tomcat 7.0.29. Also the same issue is seen since
Tomcat 7.0.21. if I remove the time delay of 1 sec, it is working fine.

Let me know, if there is any fix is available for this problem.

Regards,
Prakasaraman.V

-- 
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: r1449448 - /tomcat/trunk/res/META-INF/tomcat-websocket.jar/web-fragment.xml

2013-02-24 Thread markt
Author: markt
Date: Sun Feb 24 09:12:41 2013
New Revision: 1449448

URL: http://svn.apache.org/r1449448
Log:
Fragment names are meant to be valid java identifiers

Modified:
tomcat/trunk/res/META-INF/tomcat-websocket.jar/web-fragment.xml

Modified: tomcat/trunk/res/META-INF/tomcat-websocket.jar/web-fragment.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/META-INF/tomcat-websocket.jar/web-fragment.xml?rev=1449448&r1=1449447&r2=1449448&view=diff
==
--- tomcat/trunk/res/META-INF/tomcat-websocket.jar/web-fragment.xml (original)
+++ tomcat/trunk/res/META-INF/tomcat-websocket.jar/web-fragment.xml Sun Feb 24 
09:12:41 2013
@@ -21,6 +21,6 @@
   http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd";
   version="3.0"
   metadata-complete="true">
-  org.apache.tomcat.websocket
+  org_apache_tomcat_websocket
   
 
\ No newline at end of file



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



[Bug 53905] Connection pool not reusing connections.

2013-02-24 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53905

Konstantin Kolinko  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

-- 
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: r1449540 - in /tomcat/trunk/java/org/apache/catalina: core/ ha/ ha/session/ manager/util/ tribes/group/ util/

2013-02-24 Thread markt
Author: markt
Date: Sun Feb 24 19:56:33 2013
New Revision: 1449540

URL: http://svn.apache.org/r1449540
Log:
Checkstyle: remove nested blocks
(Testing git-svn setup on new machine)

Modified:
tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java
tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java
tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java
tomcat/trunk/java/org/apache/catalina/tribes/group/RpcChannel.java
tomcat/trunk/java/org/apache/catalina/util/Base64.java
tomcat/trunk/java/org/apache/catalina/util/DOMWriter.java

Modified: 
tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java?rev=1449540&r1=1449539&r2=1449540&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 
Sun Feb 24 19:56:33 2013
@@ -320,39 +320,32 @@ public final class ApplicationFilterFact
  */
 private boolean matchDispatcher(FilterMap filterMap, DispatcherType type) {
 switch (type) {
-case FORWARD : {
+case FORWARD :
 if ((filterMap.getDispatcherMapping() & FilterMap.FORWARD) > 
0) {
 return true;
 }
 break;
-}
-case INCLUDE : {
+case INCLUDE :
 if ((filterMap.getDispatcherMapping() & FilterMap.INCLUDE) > 
0) {
 return true;
 }
 break;
-}
-case REQUEST : {
+case REQUEST :
 if ((filterMap.getDispatcherMapping() & FilterMap.REQUEST) > 
0) {
 return true;
 }
 break;
-}
-case ERROR : {
+case ERROR :
 if ((filterMap.getDispatcherMapping() & FilterMap.ERROR) > 0) {
 return true;
 }
 break;
-}
-case ASYNC : {
+case ASYNC :
 if ((filterMap.getDispatcherMapping() & FilterMap.ASYNC) > 0) {
 return true;
 }
 break;
-}
 }
 return false;
 }
-
-
 }

Modified: tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java?rev=1449540&r1=1449539&r2=1449540&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java Sun Feb 24 
19:56:33 2013
@@ -106,57 +106,58 @@ public class ClusterRuleSet extends Rule
 
 
 String channelPrefix = prefix + "Channel/";
-{ //channel properties
-digester.addObjectCreate(channelPrefix + "Membership",
- null, // MUST be specified in the element
- "className");
-digester.addSetProperties(channelPrefix + "Membership");
-digester.addSetNext(channelPrefix + "Membership",
-"setMembershipService",
-
"org.apache.catalina.tribes.MembershipService");
-
-digester.addObjectCreate(channelPrefix + "Sender",
- null, // MUST be specified in the element
- "className");
-digester.addSetProperties(channelPrefix + "Sender");
-digester.addSetNext(channelPrefix + "Sender",
-"setChannelSender",
-"org.apache.catalina.tribes.ChannelSender");
-
-digester.addObjectCreate(channelPrefix + "Sender/Transport",
- null, // MUST be specified in the element
- "className");
-digester.addSetProperties(channelPrefix + "Sender/Transport");
-digester.addSetNext(channelPrefix + "Sender/Transport",
-"setTransport",
-
"org.apache.catalina.tribes.transport.MultiPointSender");
-
-
-digester.addObjectCreate(channelPrefix + "Receiver",
- null, // MUST be specified in the element
- "className");
-digester.addSetProperties(channelPrefix + "Receiver");
-digester.addSetNext(channelPrefix + "Receiver",
- 

Re: svn commit: r1449540 - in /tomcat/trunk/java/org/apache/catalina: core/ ha/ ha/session/ manager/util/ tribes/group/ util/

2013-02-24 Thread Konstantin Kolinko
2013/2/24  :
> Author: markt
> Date: Sun Feb 24 19:56:33 2013
> New Revision: 1449540
>
> URL: http://svn.apache.org/r1449540
> Log:
> Checkstyle: remove nested blocks
> (Testing git-svn setup on new machine)

-1.
>From a quick look at it:
1) Nothing wrong with those blocks in switches. I think removing them
reduces readability. Blocks are useful when you need a local variable
there. If just some cases have them it would be inconsistent.

2) Comments in ClusterRuleSet have their scope. That scope limitation
is lost when you remove blocks.

3) Variables in SessionUtils that were local to some logical block are
now having wider scope, for no good reason.

Best regards,
Konstantin Kolinko

>
> Modified:
> tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
> tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java
> tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
> tomcat/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java
> tomcat/trunk/java/org/apache/catalina/manager/util/SessionUtils.java
> tomcat/trunk/java/org/apache/catalina/tribes/group/RpcChannel.java
> tomcat/trunk/java/org/apache/catalina/util/Base64.java
> tomcat/trunk/java/org/apache/catalina/util/DOMWriter.java
>
> Modified: 
> tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java?rev=1449540&r1=1449539&r2=1449540&view=diff
> ==
> --- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 
> (original)
> +++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 
> Sun Feb 24 19:56:33 2013
> @@ -320,39 +320,32 @@ public final class ApplicationFilterFact
>   */
>  private boolean matchDispatcher(FilterMap filterMap, DispatcherType 
> type) {
>  switch (type) {
> -case FORWARD : {
> +case FORWARD :
>  if ((filterMap.getDispatcherMapping() & FilterMap.FORWARD) > 
> 0) {
>  return true;
>  }
>  break;
> -}
> -case INCLUDE : {
> +case INCLUDE :
>  if ((filterMap.getDispatcherMapping() & FilterMap.INCLUDE) > 
> 0) {
>  return true;
>  }
>  break;
> -}
> -case REQUEST : {
> +case REQUEST :
>  if ((filterMap.getDispatcherMapping() & FilterMap.REQUEST) > 
> 0) {
>  return true;
>  }
>  break;
> -}
> -case ERROR : {
> +case ERROR :
>  if ((filterMap.getDispatcherMapping() & FilterMap.ERROR) > 
> 0) {
>  return true;
>  }
>  break;
> -}
> -case ASYNC : {
> +case ASYNC :
>  if ((filterMap.getDispatcherMapping() & FilterMap.ASYNC) > 
> 0) {
>  return true;
>  }
>  break;
> -}
>  }
>  return false;
>  }
> -
> -
>  }
>
> Modified: tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java?rev=1449540&r1=1449539&r2=1449540&view=diff
> ==
> --- tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/ha/ClusterRuleSet.java Sun Feb 24 
> 19:56:33 2013
> @@ -106,57 +106,58 @@ public class ClusterRuleSet extends Rule
>
>
>  String channelPrefix = prefix + "Channel/";
> -{ //channel properties
> -digester.addObjectCreate(channelPrefix + "Membership",
> - null, // MUST be specified in the 
> element
> - "className");
> -digester.addSetProperties(channelPrefix + "Membership");
> -digester.addSetNext(channelPrefix + "Membership",
> -"setMembershipService",
> -
> "org.apache.catalina.tribes.MembershipService");
> -
> -digester.addObjectCreate(channelPrefix + "Sender",
> - null, // MUST be specified in the 
> element
> - "className");
> -digester.addSetProperties(channelPrefix + "Sender");
> -digester.addSetNext(channelPrefix + "Sender",
> -"setChannelSender",
> -"org.apache.catalina.tribes.ChannelSender");
> -
> -digester.addObjectCreate(channelPrefix + "Sender/Transport",
> -   

Re: svn commit: r1449540 - in /tomcat/trunk/java/org/apache/catalina: core/ ha/ ha/session/ manager/util/ tribes/group/ util/

2013-02-24 Thread Mark Thomas
On 24/02/2013 22:43, Konstantin Kolinko wrote:
> 2013/2/24  :
>> Author: markt
>> Date: Sun Feb 24 19:56:33 2013
>> New Revision: 1449540
>>
>> URL: http://svn.apache.org/r1449540
>> Log:
>> Checkstyle: remove nested blocks
>> (Testing git-svn setup on new machine)
> 
> -1.
> From a quick look at it:
> 1) Nothing wrong with those blocks in switches. I think removing them
> reduces readability. Blocks are useful when you need a local variable
> there. If just some cases have them it would be inconsistent.

They are unnecessary.
The blocks don't add anything in terms of readability that the
indentation doesn't already provide.
Not all cases have blocks - they are already inconsistent.
Most case statements don't use blocks so this change actually improves
things.

> 2) Comments in ClusterRuleSet have their scope. That scope limitation
> is lost when you remove blocks.

The comment itself is probably unnecessary. The name of the prefix -
channelPrefix makes it pretty clear what those properties are for. I
left the comment as it does provide a clear visual clue as to where the
properties start.

> 3) Variables in SessionUtils that were local to some logical block are
> now having wider scope, for no good reason.

And no particular harm either.

Removing the blocks in DOMWriter identified a small amount of duplicate
code that was also removed. I view that as a good thing.

Overall I'm not particularly bothered if this commit is reverted if you
feel strongly about it. My main motivation was to test git-svn. Fixing
some issues highlighted by a currently commented out checkstyle test
seemed like a good thing to test it with.

Mark


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



Re: [VOTE] Apache Tomcat Maven Plugin 2.1

2013-02-24 Thread Olivier Lamy
+1

NOTE one binding +1 is still missing !!

Thanks
--
Olivier
Le 20 févr. 2013 22:51, "Olivier Lamy"  a écrit :

> Hi,
> I'd like to release Apache Tomcat Maven Plugin 2.1.
>
> 24 issues fixed (see changelog:
> http://tomcat.apache.org/maven-plugin-2.1/jira-report.html)
>
> Staging maven repository:
> https://repository.apache.org/content/repositories/orgapachetomcat-282/
>
> Source release files:
> https://dist.apache.org/repos/dist/dev/tomcat/maven-plugin/v2.1/
>
> Documentation site: http://tomcat.apache.org/maven-plugin-2.1/
>
> Vote open for 72H
>
> [+1]
> [0]
> [-1]
>
> Thanks
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>