svn commit: r751217 - in /tomcat/connectors/trunk/jk/native/common: jk_ajp_common.c jk_lb_worker.c jk_shm.h

2009-03-07 Thread mturk
Author: mturk
Date: Sat Mar  7 08:00:54 2009
New Revision: 751217

URL: http://svn.apache.org/viewvc?rev=751217&view=rev
Log:
If the number of the channels in error more then half of the busy channels
mark the worker global status as error

Modified:
tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
tomcat/connectors/trunk/jk/native/common/jk_shm.h

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=751217&r1=751216&r2=751217&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sat Mar  7 
08:00:54 2009
@@ -2120,6 +2120,8 @@
 aw->s->transferred += e->wr;
 if (aw->s->busy)
 aw->s->busy--;
+if (aw->s->in_error)
+aw->s->in_error--;
 if (rc == JK_TRUE) {
 aw->s->state = JK_AJP_STATE_OK;
 }
@@ -2130,6 +2132,7 @@
 else {
 aw->s->state = JK_AJP_STATE_ERROR;
 aw->s->errors++;
+aw->s->in_error++;
 aw->s->error_time = time(NULL);
 }
 }

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?rev=751217&r1=751216&r2=751217&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Sat Mar  7 08:00:54 
2009
@@ -1340,7 +1340,7 @@
  * Time for fault tolerance (if possible)...
  */
 rec->s->errors++;
-if (rec->s->busy) {
+if (rec->s->busy && (rec->s->busy / 2) > rec->in_errors) {
 rec->s->state = JK_LB_STATE_OK;
 }
 else {

Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.h
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_shm.h?rev=751217&r1=751216&r2=751217&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_shm.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.h Sat Mar  7 08:00:54 2009
@@ -98,6 +98,8 @@
 volatile int busy;
 /* Maximum number of busy channels */
 volatile int max_busy;
+/* Number of currently channels in error state */
+volatile int in_error;
 volatile time_t error_time;
 /* Number of bytes read from remote */
 volatile jk_uint64_t readed;



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



Re: mod_jk local error states vs. global error states

2009-03-07 Thread Mladen Turk

Rainer Jung wrote:

On 06.03.2009 13:32, Mladen Turk wrote:

For the rest it's simply too much to cope in a single email ;)


I put the force recovery fix and the "else" suggestion in a patch at:

http://people.apache.org/~rjung/mod_jk-dev/patches/local_states.patch



I've added 'in_error' for ajp worker.
We already have 'errors' counter, but this is
statistical one. New 'in_error' holds the number of connections
that are currently in error state.

If it's number get higher then busy/2 (more then half are in
error state) then the entire worker is marked as invalid.

Think this is much better then having additional retry for
local workers. The value busy/2 can probably be configured
via some directive similar to max_reply_timeouts,
eg, max_reply_errors.

Regards
--
^(TM)

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



Re: svn commit: r751136 - /tomcat/tc6.0.x/tags/TOMCAT_6_0_19/

2009-03-07 Thread Mark Thomas
Remy Maucherat wrote:
> On Fri, 2009-03-06 at 23:32 +, r...@apache.org wrote:
>> Author: remm
>> Date: Fri Mar  6 23:32:40 2009
>> New Revision: 751136
>>
>> URL: http://svn.apache.org/viewvc?rev=751136&view=rev
>> Log:
>> - Apache Tomcat 6.0.19.
>>
>> Added:
>> tomcat/tc6.0.x/tags/TOMCAT_6_0_19/   (props changed)
>>   - copied from r751135, tomcat/tc6.0.x/trunk/
>>
>> Propchange: tomcat/tc6.0.x/tags/TOMCAT_6_0_19/
>> --
>> --- svn:ignore (added)
>> +++ svn:ignore Fri Mar  6 23:32:40 2009
>> @@ -0,0 +1,3 @@
>> +output
>> +.settings
>> +build.properties
>>
>> Propchange: tomcat/tc6.0.x/tags/TOMCAT_6_0_19/
>> --
>> --- svn:mergeinfo (added)
>> +++ svn:mergeinfo Fri Mar  6 23:32:40 2009
>> @@ -0,0 +1 @@
>> +/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719602,719626,719628,720046,720069,721040,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,747834,747863,748344,750258,750291,750921
> 
> The build is in the usual place in ~remm (built with a new computer, so
> it's a good idea to test it), but I don't know if these weird
> propchanges mean something bad.

I don't think so. They are a side effect of using "svn merge" with 1.5
clients to merge patches from trunk to 6.0.x. svn now tries to keep
track of what has been merged and what hasn't so it can do a better job
of future merges.

Mark


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



svn commit: r751239 - /tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

2009-03-07 Thread rjung
Author: rjung
Date: Sat Mar  7 10:37:57 2009
New Revision: 751239

URL: http://svn.apache.org/viewvc?rev=751239&view=rev
Log:
No functional change, fix typos and reformat comments.

Modified:
tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=751239&r1=751238&r2=751239&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sat Mar  7 
10:37:57 2009
@@ -,8 +,10 @@
  * @param ae   endpoint
  * @param msg  message to send
  * @param llogger
- * @return JK_FALSE: failure
- * JK_TRUE: success
+ * @return JK_TRUE: success
+ * JK_FALSE: could not read the AJP packet header
+ * JK_AJP_PROTOCOL_ERROR: failure after reading
+ * the AJP packet header
  * @remark Always closes socket in case of
  * a socket error
  * @remark Cares about ae->last_errno
@@ -1245,8 +1247,8 @@
 }
 ae->sd = JK_INVALID_SOCKET;
 JK_TRACE_EXIT(l);
-/* Altough connection, this is effectively protocol error.
- * We got the AJP header packet, but not the packet payload
+/* Although we have a connection, this is effectively a protocol error.
+ * We received the AJP header packet, but not the packet payload
  */
 return JK_AJP_PROTOCOL_ERROR;
 }
@@ -1880,7 +1882,9 @@
  * return value   op->recoverablereason
  * JK_REPLY_TIMEOUT   ?recovery_options  Reply timeout while waiting for 
response packet
  * JK_FALSE   ?recovery_options  Error during 
ajp_connection_tcp_get_message()
- *   Communication error or wrong packet content while reading from 
backend.
+ *   Could not read the AJP packet header
+ * JK_AJP_PROTOCOL_ERROR: ?recovery_options  Error during 
ajp_connection_tcp_get_message()
+ *   Failure after reading the AJP packet header
  * JK_STATUS_ERRORmostly JK_TRUE ajp_process_callback() returns 
JK_STATUS_ERROR
  *   Recoverable, if callback didn't return with a JK_HAS_RESPONSE 
before.
  *   JK_HAS_RESPONSE: parts of the post buffer are consumed.
@@ -2162,17 +2166,17 @@
  *   Only if op->recoverable and no more ajp13/ajp14 direct retries
  * JK_STATUS_ERROR   JK_HTTP_SERVER_BUSY   JK_FALSE   ajp_get_reply() 
returns JK_STATUS_ERROR
  *   Only if !op->recoverable
- * JK_STATUS_FATAL_ERROR JK_HTTP_SERVER_BUSY JK_TRUE  ajp_get_reply() 
returns JK_STATUS_ERROR
+ * JK_STATUS_FATAL_ERROR JK_HTTP_SERVER_BUSY  JK_TRUE ajp_get_reply() 
returns JK_STATUS_ERROR
  *   Only if op->recoverable and no more ajp13/ajp14 direct retries
- * JK_STATUS_FATAL_ERROR JK_HTTP_SERVER_BUSY JK_FALSE ajp_get_reply() 
returns JK_STATUS_FATAL_ERROR
+ * JK_STATUS_FATAL_ERROR JK_HTTP_SERVER_BUSY  JK_FALSEajp_get_reply() 
returns JK_STATUS_FATAL_ERROR
  *   Only if !op->recoverable
  * JK_REPLY_TIMEOUT  JK_HTTP_GATEWAY_TIME_OUT JK_TRUE ajp_get_reply() 
returns JK_REPLY_TIMEOUT
- * JK_AJP_PROTOCOL_ERROR  JK_HTTP_GATEWAY_TIME_OUT JK_TRUEajp_get_reply() 
returns JK_AJP_PROTOCOL_ERROR
+ * JK_AJP_PROTOCOL_ERROR JK_HTTP_GATEWAY_TIME_OUT ?   ajp_get_reply() 
returns JK_AJP_PROTOCOL_ERROR
  * ??? JK_FATAL_ERRORJK_HTTP_GATEWAY_TIME_OUT JK_FALSEajp_get_reply() 
returns something else
  *   Only if !op->recoverable
- * ??? JK_FALSE  JK_HTTP_SERVER_BUSYJK_TRUEajp_get_reply() 
returns JK_FALSE
+ * ??? JK_FALSE  JK_HTTP_SERVER_BUSY   JK_TRUEajp_get_reply() 
returns JK_FALSE
  *   Only if op->recoverable and no more ajp13/ajp14 direct retries
- * JK_TRUE   JK_HTTP_OK ? OK
+ * JK_TRUE   JK_HTTP_OK?  OK
  */
 static int JK_METHOD ajp_service(jk_endpoint_t *e,
  jk_ws_service_t *s,



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



Re: svn commit: r751213 - in /tomcat/connectors/trunk/jk/native/common: jk_ajp13.h jk_ajp_common.c jk_lb_worker.c

2009-03-07 Thread Rainer Jung

On 07.03.2009 08:18, mt...@apache.org wrote:

Author: mturk
Date: Sat Mar  7 07:18:08 2009
New Revision: 751213

URL: http://svn.apache.org/viewvc?rev=751213&view=rev
Log:
Retun protocol error from ajp get message.
This allows to make difference weather we got something from the server or the
nothing at all.


Good thing.


Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?rev=751213&r1=751212&r2=751213&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Sat Mar  7 07:18:08 
2009
@@ -1288,6 +1288,17 @@
  rec->s->error_time = 0;
  rc = JK_FALSE;
  }
+else if (service_stat == JK_AJP_PROTOCOL_ERROR) {
+/*
+ * We've received the bad AJP message from the backend.
+ * Don't mark the node as bad.
+ * Failing over to another node could help.
+ */
+rec->s->state  = JK_LB_STATE_OK;


Now you make me wonder again: if the backend responds with messages, but 
those are not AJP compliant, isn't that a good reason to take it out of 
service, i.e. setting global to ERROR?


It is not just an overload situation, the thing either can't talk AJP, 
or it is OutOfMemory or something similar.


Why do we think it has any chance to heal itself?


+p->states[rec->i] = JK_LB_STATE_ERROR;
+rec->s->error_time = 0;
+rc = JK_FALSE;
+}
  else if (service_stat == JK_STATUS_FATAL_ERROR) {
  /*
   * Status code configured as service is down.


Regards,

Rainer

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



Re: svn commit: r751217 - in /tomcat/connectors/trunk/jk/native/common: jk_ajp_common.c jk_lb_worker.c jk_shm.h

2009-03-07 Thread Rainer Jung

On 07.03.2009 09:00, mt...@apache.org wrote:

Author: mturk
Date: Sat Mar  7 08:00:54 2009
New Revision: 751217

URL: http://svn.apache.org/viewvc?rev=751217&view=rev
Log:
If the number of the channels in error more then half of the busy channels
mark the worker global status as error

Modified:
 tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
 tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
 tomcat/connectors/trunk/jk/native/common/jk_shm.h

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=751217&r1=751216&r2=751217&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sat Mar  7 
08:00:54 2009
@@ -2120,6 +2120,8 @@
  aw->s->transferred += e->wr;
  if (aw->s->busy)
  aw->s->busy--;
+if (aw->s->in_error)
+aw->s->in_error--;
  if (rc == JK_TRUE) {
  aw->s->state = JK_AJP_STATE_OK;
  }
@@ -2130,6 +2132,7 @@
  else {
  aw->s->state = JK_AJP_STATE_ERROR;
  aw->s->errors++;
+aw->s->in_error++;
  aw->s->error_time = time(NULL);
  }
  }


I think this can't possibly work. We decrement once for each ended 
request (error or not) and we increment after the request if it returned 
with an error.


So if

- the value is zero and we have an error we end up with value 1
- the value is one and we have no error we end up with zero
- the value is one and we have another error we end up again with 
1-1+1=1 (not 2).


Therefore we will never exceed the value 1 as in_error here.

Plan B: Counting error excess

We could change it to decrement only in the cases JK_TRUE or 
JK_CLIENT_ERROR, but then we would count the excess of errors over OK 
requests. So whenever more OKs follow than errors, the counter would go 
to 0 again. The problem with this counter is, that I can not see any 
good criterion how to decide about the global node state. The excess 
could only be related to the load, e.g. relative to how many requests 
per time we were handling recently. That's another number we don't have.


Something along:

- add a special request counter x
- handle in_errors as described in B)
- reset x to zero whenever the in_errors is zero
- increment x by one for each request as long as in_errors is positive
- in lb "else" choose global error if in_error is bigger than N% of x 
(e.g. N=10 or N=50). But wait, we need some correction for small 
in_errors, like in_errors=x=1.


Plan C: Counting error endpoints (approximation of busy errors)

Each endpoint could remember whether it last had an error or not. Then 
after the request it would


- increment in_errors, if it went from OK to error
- decrement in_errors, if it went from error to OK
- keep in_errors same otherwise

But still, since there is no fair usage distribution over the endpoints, 
this will not give a useful number (lots of OK requests could use the 
same endpoint and all the error requests could be distributed over many 
different endpoints or vice versa).


The problem comes from the fact, that busy is a snapshot number, and 
there is no way to tell, how many of the requests being on the fly, will 
return with an error.


Summary:

I still like the idea of using the error_time. Each OK request will 
reset it, and that's fine. As long as there's something good coming back 
we have a global chance. But if there are no OK's for some time we 
should switch to global ERROR.


After 10 seconds or after 60 seconds: I think 60 seconds is pretty long, 
but I would accept as a compromise :)


Regards,

Rainer

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



[g...@vmgump]: Project jakarta-tomcat-jk-native (in module jakarta-tomcat-connectors) failed

2009-03-07 Thread Bill Barker
To whom it may engage...

This is an automated request, but not an unsolicited one. For 
more information please visit http://gump.apache.org/nagged.html, 
and/or contact the folk at gene...@gump.apache.org.

Project jakarta-tomcat-jk-native has an issue affecting its community 
integration.
This issue affects 1 projects.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- jakarta-tomcat-jk-native :  Connectors to various web servers


Full details are available at:

http://vmgump.apache.org/gump/public/jakarta-tomcat-connectors/jakarta-tomcat-jk-native/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -INFO- Failed with reason build failed



The following work was performed:
http://vmgump.apache.org/gump/public/jakarta-tomcat-connectors/jakarta-tomcat-jk-native/gump_work/build_jakarta-tomcat-connectors_jakarta-tomcat-jk-native.html
Work Name: build_jakarta-tomcat-connectors_jakarta-tomcat-jk-native (Type: 
Build)
Work ended in a state of : Failed
Elapsed: 22 secs
Command Line: make 
[Working Directory: 
/srv/gump/public/workspace/jakarta-tomcat-connectors/jk/native]
-
Making all in common
make[1]: Entering directory 
`/srv/gump/public/workspace/jakarta-tomcat-connectors/jk/native/common'
/srv/gump/public/workspace/apr/dest-07032009/build-2/libtool --silent 
--mode=compile ccache gcc 
-I/srv/gump/public/workspace/apache-httpd/dest-07032009/include -g -O2 -g -O2 
-pthread -DHAVE_APR  
-I/srv/gump/public/workspace/apr/dest-07032009/include/apr-2 
-I/srv/gump/public/workspace/apr-util/dest-07032009/include/apr-2 -g -O2 
-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I 
/usr/lib/jvm/java-6-sun/include -I /usr/lib/jvm/java-6-sun/include/ -c 
jk_ajp12_worker.c -o jk_ajp12_worker.lo
/srv/gump/public/workspace/apr/dest-07032009/build-2/libtool --silent 
--mode=compile ccache gcc 
-I/srv/gump/public/workspace/apache-httpd/dest-07032009/include -g -O2 -g -O2 
-pthread -DHAVE_APR  
-I/srv/gump/public/workspace/apr/dest-07032009/include/apr-2 
-I/srv/gump/public/workspace/apr-util/dest-07032009/include/apr-2 -g -O2 
-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I 
/usr/lib/jvm/java-6-sun/include -I /usr/lib/jvm/java-6-sun/include/ -c 
jk_connect.c -o jk_connect.lo
/srv/gump/public/workspace/apr/dest-07032009/build-2/libtool --silent 
--mode=compile ccache gcc 
-I/srv/gump/public/workspace/apache-httpd/dest-07032009/include -g -O2 -g -O2 
-pthread -DHAVE_APR  
-I/srv/gump/public/workspace/apr/dest-07032009/include/apr-2 
-I/srv/gump/public/workspace/apr-util/dest-07032009/include/apr-2 -g -O2 
-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I 
/usr/lib/jvm/java-6-sun/include -I /usr/lib/jvm/java-6-sun/include/ -c 
jk_msg_buff.c -o jk_msg_buff.lo
/srv/gump/public/workspace/apr/dest-07032009/build-2/libtool --silent 
--mode=compile ccache gcc 
-I/srv/gump/public/workspace/apache-httpd/dest-07032009/include -g -O2 -g -O2 
-pthread -DHAVE_APR  
-I/srv/gump/public/workspace/apr/dest-07032009/include/apr-2 
-I/srv/gump/public/workspace/apr-util/dest-07032009/include/apr-2 -g -O2 
-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I 
/usr/lib/jvm/java-6-sun/include -I /usr/lib/jvm/java-6-sun/include/ -c 
jk_util.c -o jk_util.lo
/srv/gump/public/workspace/apr/dest-07032009/build-2/libtool --silent 
--mode=compile ccache gcc 
-I/srv/gump/public/workspace/apache-httpd/dest-07032009/include -g -O2 -g -O2 
-pthread -DHAVE_APR  
-I/srv/gump/public/workspace/apr/dest-07032009/include/apr-2 
-I/srv/gump/public/workspace/apr-util/dest-07032009/include/apr-2 -g -O2 
-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I 
/usr/lib/jvm/java-6-sun/include -I /usr/lib/jvm/java-6-sun/include/ -c 
jk_ajp13.c -o jk_ajp13.lo
/srv/gump/public/workspace/apr/dest-07032009/build-2/libtool --silent 
--mode=compile ccache gcc 
-I/srv/gump/public/workspace/apache-httpd/dest-07032009/include -g -O2 -g -O2 
-pthread -DHAVE_APR  
-I/srv/gump/public/workspace/apr/dest-07032009/include/apr-2 
-I/srv/gump/public/workspace/apr-util/dest-07032009/include/apr-2 -g -O2 
-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I 
/usr/lib/jvm/java-6-sun/include -I /usr/lib/jvm/java-6-sun/include/ -c 
jk_pool.c -o jk_pool.lo
/srv/gump/public/workspace/apr/dest-07032009/build-2/libtool --silent 
--mode=compile ccache gcc 
-I/srv/gump/public/workspace/apache-httpd/dest-07032009/include -g -O2 -g -O2 
-pthread -DHAVE_APR  
-I/srv/gump/public/workspace/apr/dest-07032009/include/apr-2 
-I/srv/gump/public/workspace/apr-util/dest-07032009/include/apr-2 -g -O2 
-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I 
/usr/lib/jvm/java-6-sun/include -I /usr/lib/jvm/java-6-sun/include/ -c 
jk_worker.c -o jk_worker.lo
/srv/gump/public/workspace/apr/dest-070

DO NOT REPLY [Bug 46764] Tomcat 6 and xmlValidation="false" not working

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46764


Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||WORKSFORME




--- Comment #3 from Mark Thomas   2009-03-07 06:03:59 PST ---
I can't reproduce this. With the sample JSP code you have provided, this just
works.

There is also something odd about your configuration. A clean installation
won't even look at a JSP on start-up, let alone try and parse it.

If you still see this error on a clean Tomcat 6.0.18 installation downloaded
from the ASF (not installed via your OS's packaging system) please provide the
complete source for a single JSP that demonstrates this issue on the clean
installation so we can investigate further.

-- 
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: r751275 - in /tomcat/connectors/trunk/jk/native/common: jk_ajp_common.c jk_lb_worker.c jk_shm.h

2009-03-07 Thread mturk
Author: mturk
Date: Sat Mar  7 14:19:23 2009
New Revision: 751275

URL: http://svn.apache.org/viewvc?rev=751275&view=rev
Log:
Revert the in_error counter

Modified:
tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
tomcat/connectors/trunk/jk/native/common/jk_shm.h

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=751275&r1=751274&r2=751275&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sat Mar  7 
14:19:23 2009
@@ -2124,8 +2124,6 @@
 aw->s->transferred += e->wr;
 if (aw->s->busy)
 aw->s->busy--;
-if (aw->s->in_error)
-aw->s->in_error--;
 if (rc == JK_TRUE) {
 aw->s->state = JK_AJP_STATE_OK;
 }
@@ -2136,7 +2134,6 @@
 else {
 aw->s->state = JK_AJP_STATE_ERROR;
 aw->s->errors++;
-aw->s->in_error++;
 aw->s->error_time = time(NULL);
 }
 }

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?rev=751275&r1=751274&r2=751275&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Sat Mar  7 14:19:23 
2009
@@ -1340,7 +1340,7 @@
  * Time for fault tolerance (if possible)...
  */
 rec->s->errors++;
-if (rec->s->busy && (rec->s->busy / 2) > rec->in_errors) {
+if (rec->s->busy) {
 rec->s->state = JK_LB_STATE_OK;
 }
 else {

Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.h
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_shm.h?rev=751275&r1=751274&r2=751275&view=diff
==
--- tomcat/connectors/trunk/jk/native/common/jk_shm.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.h Sat Mar  7 14:19:23 2009
@@ -98,8 +98,6 @@
 volatile int busy;
 /* Maximum number of busy channels */
 volatile int max_busy;
-/* Number of currently channels in error state */
-volatile int in_error;
 volatile time_t error_time;
 /* Number of bytes read from remote */
 volatile jk_uint64_t readed;



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



Re: svn commit: r751217 - in /tomcat/connectors/trunk/jk/native/common: jk_ajp_common.c jk_lb_worker.c jk_shm.h

2009-03-07 Thread Mladen Turk

Rainer Jung wrote:

On 07.03.2009 09:00, mt...@apache.org wrote:

Summary:

I still like the idea of using the error_time. Each OK request will 
reset it, and that's fine. As long as there's something good coming back 
we have a global chance. But if there are no OK's for some time we 
should switch to global ERROR.




Good point, I've reverted the patch.

After 10 seconds or after 60 seconds: I think 60 seconds is pretty long, 
but I would accept as a compromise :)




Let's use the recover_wait_time here, or if you still think
this is huge value I'll handle the recover_wait_time / 2 :)

Regards
--
^(TM)

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



DO NOT REPLY [Bug 46808] mod_jk 1.2.27 can't detect network error

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46808





--- Comment #6 from Eiji Takahashi   2009-03-07 07:28:41 
PST ---
Hi.

I'm sorry that the explanation is insufficient. 

I used the roughly following settings. 
-
worker.list=wlb

# not use socket_connect_timeout
worker.ap00.socket_timeout=5
worker.ap00.prepost_timeout=3000
worker.ap00.connect_timeout=3000

# not use max_reply_timeouts
worker.ap00.reply_timeout=31

worker.ap00.recovery_options=3

worker.ap01.reference=ap00
worker.ap02.reference=ap00

worker.wlb.sticky_session=True
worker.wlb.sticky_session_force=False
worker.wlb.balance_workers=ap01, ap02
worker.wlb.method=B
---

Please look at the attached log about an actual situation. 
 - The NW cable has been pulled out around 13:35:47.
 - The request that has ap01 as route tried to connect to ap01, and failed to
connect. And ap01 was in local error state (not error state).
 - Ap01 had become in error state (not local error state) at 13:50:06. It seems
that it is because all sessionid with ap01 as a route ended. 

When the NW cable on the ap01 side is pulled out, the request that has been
transmitted to Tomcat returns error to the client because of recovery_options
is set to 3. I think that this is not a problem. 

However, when the state of lbworker doesn't become JK_LB_STATE_ERROR, the
request that has ap01 as route in the sessionid tries to connect to ap01. And
keeps trying to connect to ap01 until sessionid become invalid. I think that
this is a problem, because "socket_timeout * retries" ( equals 10secs in my
case ) is added to the request processing time without fail. 

When the request that don't have sessionid connects to ap01, the time for the
connection is wasted.  I think this is a problem, too. However, because the
failover occurs, the request is forwarded to ap02 and sessionid is given in
ap02. As a result, the next time of this request is not transmitted to ap01.

Best regards.

-- 
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 46803] Configuration fix for jsvc daemon

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46803


Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED




--- Comment #1 from Mark Thomas   2009-03-07 07:43:01 PST ---
jsvc is part of Commons Daemon. I created
https://issues.apache.org/jira/browse/DAEMON-123 to track this.

Thanks for the patch. I have applied it and it will be included in the next
release.

-- 
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 46808] mod_jk 1.2.27 can't detect network error

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46808





--- Comment #7 from Eiji Takahashi   2009-03-07 07:43:57 
PST ---
Created an attachment (id=23349)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23349)
log file 1 of 4

-- 
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 46808] mod_jk 1.2.27 can't detect network error

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46808





--- Comment #8 from Eiji Takahashi   2009-03-07 07:44:52 
PST ---
Created an attachment (id=23350)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23350)
log file 2 of 4

-- 
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 46808] mod_jk 1.2.27 can't detect network error

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46808





--- Comment #9 from Eiji Takahashi   2009-03-07 07:45:38 
PST ---
Created an attachment (id=23351)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23351)
log file 3 of 4

-- 
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 46808] mod_jk 1.2.27 can't detect network error

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46808





--- Comment #10 from Eiji Takahashi   2009-03-07 07:47:10 
PST ---
Created an attachment (id=23352)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23352)
log file 4 of 4

-- 
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 46808] mod_jk 1.2.27 can't detect network error

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46808





--- Comment #11 from Eiji Takahashi   2009-03-07 07:49:16 
PST ---
Oops! I'm sorry. The log file was too large. I divided the log file.

-- 
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: r751286 - /tomcat/trunk/webapps/docs/jasper-howto.xml

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 16:00:22 2009
New Revision: 751286

URL: http://svn.apache.org/viewvc?rev=751286&view=rev
Log:
Partial fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=46807
Correctly document org.apache.japser.runtime.JspFactoryImpl.USE_POOL

Modified:
tomcat/trunk/webapps/docs/jasper-howto.xml

Modified: tomcat/trunk/webapps/docs/jasper-howto.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/jasper-howto.xml?rev=751286&r1=751285&r2=751286&view=diff
==
--- tomcat/trunk/webapps/docs/jasper-howto.xml (original)
+++ tomcat/trunk/webapps/docs/jasper-howto.xml Sat Mar  7 16:00:22 2009
@@ -337,7 +337,7 @@
 
  When you switch to another Tomcat release, then regenerate and recompile
 your jsp's with the new Tomcat version.
-Use java system property at server runtime to disable tag pooling
+Use java system property at server runtime to disable PageContext pooling
 org.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false.
 and limit the buffering with
 org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true. Note



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



svn commit: r751287 - in /tomcat/trunk: conf/web.xml webapps/docs/jasper-howto.xml

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 16:08:41 2009
New Revision: 751287

URL: http://svn.apache.org/viewvc?rev=751287&view=rev
Log:
Fix remainder of https://issues.apache.org/bugzilla/show_bug.cgi?id=46807
Make it clear that enablePooling is a compilation, not a runtime option.

Modified:
tomcat/trunk/conf/web.xml
tomcat/trunk/webapps/docs/jasper-howto.xml

Modified: tomcat/trunk/conf/web.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/conf/web.xml?rev=751287&r1=751286&r2=751287&view=diff
==
--- tomcat/trunk/conf/web.xml (original)
+++ tomcat/trunk/conf/web.xml Sat Mar  7 16:08:41 2009
@@ -149,7 +149,9 @@
   
   
   
-  
+  
+  
+  
   
   
   

Modified: tomcat/trunk/webapps/docs/jasper-howto.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/jasper-howto.xml?rev=751287&r1=751286&r2=751287&view=diff
==
--- tomcat/trunk/webapps/docs/jasper-howto.xml (original)
+++ tomcat/trunk/webapps/docs/jasper-howto.xml Sat Mar  7 16:08:41 2009
@@ -126,7 +126,9 @@
 false. false if suppressSmap is true.
 
 enablePooling - Determines whether tag handler pooling is
-enabled. true or false, default true.
+enabled. This is a compilation option. It will not alter the behaviour of JSPs
+that have already been compiled. true or false,
+default true.
 
 
 engineOptionsClass - Allows specifying the Options class



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



svn commit: r751288 - in /tomcat/tc6.0.x/trunk: ./ conf/web.xml webapps/docs/changelog.xml webapps/docs/jasper-howto.xml

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 16:15:26 2009
New Revision: 751288

URL: http://svn.apache.org/viewvc?rev=751288&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46807
Correct docs for configuration of tag pooling

Modified:
tomcat/tc6.0.x/trunk/   (props changed)
tomcat/tc6.0.x/trunk/conf/web.xml
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc6.0.x/trunk/webapps/docs/jasper-howto.xml

Propchange: tomcat/tc6.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Mar  7 16:15:26 2009
@@ -1 +1 @@
-/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719602,719626,719628,720046,720069,721040,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,747834,747863,748344,750258,750291,750921
+/tomcat/trunk:601180,606992,612607,630314,640888,652744,653247,673796,673820,683982,684001,684081,684234,684269-684270,685177,687503,687645,689402,690781,691392,691805,692748,693378,694992,695053,695311,696780,696782,698012,698227,698236,698613,699427,699634,701355,709294,709811,709816,710063,710066,710125,710205,711126,711600,712461,712467,718360,719602,719626,719628,720046,720069,721040,723404,723738,726052,727303,728032,728768,728947,729057,729567,729569,729571,729809,729815,729934,730250,730590,731651,732859,732863,734734,740675,740684,742677,742697,742714,744160,744238,746321,746384,747834,747863,748344,750258,750291,750921,751286-751287

Modified: tomcat/tc6.0.x/trunk/conf/web.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/conf/web.xml?rev=751288&r1=751287&r2=751288&view=diff
==
--- tomcat/tc6.0.x/trunk/conf/web.xml (original)
+++ tomcat/tc6.0.x/trunk/conf/web.xml Sat Mar  7 16:15:26 2009
@@ -180,7 +180,9 @@
   
   
   
-  
+  
+  
+  
   
   
   

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=751288&r1=751287&r2=751288&view=diff
==
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sat Mar  7 16:15:26 2009
@@ -32,6 +32,15 @@
   
 
 
+
+  
+
+  
+46807: Correct docs for configuration of tag pooling. 
(markt)
+  
+
+  
+
 
   
 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/jasper-howto.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/jasper-howto.xml?rev=751288&r1=751287&r2=751288&view=diff
==
--- tomcat/tc6.0.x/trunk/webapps/docs/jasper-howto.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/jasper-howto.xml Sat Mar  7 16:15:26 2009
@@ -126,7 +126,9 @@
 false. false if suppressSmap is true.
 
 enablePooling - Determines whether tag handler pooling is
-enabled. true or false, default true.
+enabled. This is a compilation option. It will not alter the behaviour of JSPs
+that have already been compiled. true or false,
+default true.
 
 
 engineOptionsClass - Allows specifying the Options class
@@ -337,7 +339,7 @@
 
  When you switch to another Tomcat release, then regenerate and recompile
 your jsp's with the new Tomcat version.
-Use java system property at server runtime to disable tag pooling
+Use java system property at server runtime to disable PageContext pooling
 org.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false.
 and limit the buffering with
 org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true. Note



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



DO NOT REPLY [Bug 46807] Cannot disable jsp tag pooling

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46807


Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED




--- Comment #3 from Mark Thomas   2009-03-07 08:16:45 PST ---
Sorry for the confusion.

org.apache.jasper.runtime.JspFactoryImpl.USE_POOL controls the pooling of
PageContext objects, not tag instances. I have updated the docs to reflect
this.

I have also update the docs to make to clear that enablePooling is a compile
time option, not a runtime one.

The changes have been applied to trunk and 6.0.x and will be included in 6.0.20
onwards.

-- 
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: r751289 - in /tomcat/trunk/java/org/apache/catalina/users: LocalStrings.properties MemoryUserDatabase.java

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 16:28:46 2009
New Revision: 751289

URL: http://svn.apache.org/viewvc?rev=751289&view=rev
Log:
Make UserDatabase read only by default and log an error if someone tries to 
save changes.

Modified:
tomcat/trunk/java/org/apache/catalina/users/LocalStrings.properties
tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java

Modified: tomcat/trunk/java/org/apache/catalina/users/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/users/LocalStrings.properties?rev=751289&r1=751288&r2=751289&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/users/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/users/LocalStrings.properties Sat Mar 
 7 16:28:46 2009
@@ -18,3 +18,4 @@
 memoryUserDatabase.renameNew=Cannot rename new file to {0}
 memoryUserDatabase.writeException=IOException writing to {0}
 memoryUserDatabase.notPersistable=User database is not persistable - no write 
permissions on directory
+memoryUserDatabase.readOnly=User database has been configured to be read only. 
Changes cannot be saved

Modified: tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java?rev=751289&r1=751288&r2=751289&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java Sat Mar 
 7 16:28:46 2009
@@ -120,7 +120,7 @@
 /**
  * A flag, indicating if the user database is read only.
  */
-protected boolean readonly = false;
+protected boolean readonly = true;
 
 /**
  * The set of {...@link Role}s defined in this database, keyed by
@@ -500,6 +500,7 @@
 public void save() throws Exception {
 
 if (getReadonly()) {
+log.error(sm.getString("memoryUserDatabase.readOnly"));
 return;
 }
 



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



svn commit: r751291 - /tomcat/tc6.0.x/trunk/STATUS.txt

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 16:33:42 2009
New Revision: 751291

URL: http://svn.apache.org/viewvc?rev=751291&view=rev
Log:
Proposal for bz 46815

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=751291&r1=751290&r2=751291&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Mar  7 16:33:42 2009
@@ -94,3 +94,9 @@
   functionality of the API. It just gives folks that may be using this old
   code a warning that it won't be there in the next version.
   -1: 
+
+* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46815
+  http://svn.apache.org/viewvc?rev=751289&view=rev
+  Make MemoryUserDatabase read-only by default
+  +1: markt
+  -1: 



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



DO NOT REPLY [Bug 46815] Tomcat user database file - permission problem on Unix systems

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46815





--- Comment #3 from Mark Thomas   2009-03-07 08:33:47 PST ---
I suspect that it is read write by default as a legacy of the 5.5.x admin app
which could add and remove users (you can still do this in 6.0.x using jmx).

I assume you are aware that this realm isn't intended for production use
(although lots of people do...)

I have changed it to read only by default in trunk and proposed the change for
6.0.x. It may not get back-ported for fear of breaking existing installations.

-- 
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: r751295 - /tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 16:54:46 2009
New Revision: 751295

URL: http://svn.apache.org/viewvc?rev=751295&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46816
Align mbean descriptor attributes with implementations

Modified:
tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml

Modified: tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml?rev=751295&r1=751294&r2=751295&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml Sat 
Mar  7 16:54:46 2009
@@ -240,10 +240,6 @@
  type="java.lang.String"
 writeable="false"/>
 
-
-
 
 
+
+
+
+
 



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



svn commit: r751296 - /tomcat/tc6.0.x/trunk/STATUS.txt

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 16:56:22 2009
New Revision: 751296

URL: http://svn.apache.org/viewvc?rev=751296&view=rev
Log:
Propose fix for 46816

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=751296&r1=751295&r2=751296&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Mar  7 16:56:22 2009
@@ -100,3 +100,9 @@
   Make MemoryUserDatabase read-only by default
   +1: markt
   -1: 
+
+* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46816
+  http://svn.apache.org/viewvc?rev=751295&view=rev
+  Align mbean with implementation
+  +1: markt
+  -1:



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



DO NOT REPLY [Bug 46816] /status/all fails if using PersistentManager

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46816





--- Comment #1 from Mark Thomas   2009-03-07 08:56:44 PST ---
The getter was missing in the mbean descriptor.

I have added it in trunk and proposed the change for 6.0.x

-- 
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 46808] mod_jk 1.2.27 can't detect network error

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46808


Mladen Turk  changed:

   What|Removed |Added

  Component|Common  |mod_jk




--- Comment #12 from Mladen Turk   2009-03-07 10:22:54 PST ---
> However, when the state of lbworker doesn't become JK_LB_STATE_ERROR, the
> request that has ap01 as route in the sessionid tries to connect to ap01. And
> keeps trying to connect to ap01 until sessionid become invalid.

Nope this is completely valid. The node is retried in a conservative maner.
Before pulling out the cable you should mark the node a Disabled, and
when all sessions times out, then pull the cable.

We cannot simply kill all sessions if one of them fails.
Rainer is working on a solution that will allow to make that
delay not larger then recover_wait_timeout.

Again, this is edge case and you should really not pull out
the cables out of production servers :)

-- 
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: r751303 - in /tomcat/trunk/java/org/apache/jk: apr/ common/ChannelJni.java common/ChannelShm.java common/ChannelUn.java common/JniHandler.java common/Shm.java common/Shm14.java

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 18:32:40 2009
New Revision: 751303

URL: http://svn.apache.org/viewvc?rev=751303&view=rev
Log:
Remove jk jni code from Tomcat 7. It is deprecated in mod_jk and will almost 
certainly have been rmeoved by the time 7.0.x has a stable release.
Shout if I deleted something I shouldn't have.

Removed:
tomcat/trunk/java/org/apache/jk/apr/
tomcat/trunk/java/org/apache/jk/common/ChannelJni.java
tomcat/trunk/java/org/apache/jk/common/ChannelShm.java
tomcat/trunk/java/org/apache/jk/common/ChannelUn.java
tomcat/trunk/java/org/apache/jk/common/JniHandler.java
tomcat/trunk/java/org/apache/jk/common/Shm.java
tomcat/trunk/java/org/apache/jk/common/Shm14.java


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



svn commit: r751304 - in /tomcat/trunk: java/org/apache/catalina/valves/AddDefaultCharsetValve.java webapps/docs/config/valve.xml

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 18:45:53 2009
New Revision: 751304

URL: http://svn.apache.org/viewvc?rev=751304&view=rev
Log:
Add AddDefaultCharSetValve

Added:
tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java   
(with props)
Modified:
tomcat/trunk/webapps/docs/config/valve.xml

Added: tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java?rev=751304&view=auto
==
--- tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java 
(added)
+++ tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java 
Sat Mar  7 18:45:53 2009
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.valves;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.apache.catalina.valves.ValveBase;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+/**
+ * Valve that explicitly sets the default character set for media subtypes of
+ * the "text" type to ISO-8859-1. RFC2616 explicitly states that browsers must
+ * use ISO-8859-1 in these circumstances. However, browsers may attempt to
+ * auto-detect the character set. This may be exploited by an attacker to
+ * perform an XSS attack. Internet Explorer has this behaviour by default. 
Other
+ * browsers have an option to enable it.
+ * 
+ * This valve prevents the attack by explicitly setting a character set. Unless
+ * the provided character set is explicitly overridden by the user - in which
+ * case they deserve everything they get - the browser will adhere to an
+ * explicitly set character set, thus preventing the XSS attack.
+ * 
+ * To use this valve add the following 
+ * to your Engine, Host or Context as
+ * required.
+ */
+
+public class AddDefaultCharsetValve
+extends ValveBase {
+
+/**
+ * Check for text/* and no character set and set charset to ISO-8859-1 in
+ * those circumstances.
+ */
+public void invoke(Request request, Response response)
+throws IOException, ServletException {
+
+// Process the request first
+getNext().invoke(request, response);
+
+// Test once the response has been generated
+String ct = response.getContentType();
+if (ct != null && ct.startsWith("text/")) {
+// Make sure the charset is explicitly set
+response.setCharacterEncoding(response.getCharacterEncoding());
+}
+}
+
+}

Propchange: 
tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java
--
svn:eol-style = native

Propchange: 
tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java
--
svn:keywords = Date Author Id Revision

Modified: tomcat/trunk/webapps/docs/config/valve.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/valve.xml?rev=751304&r1=751303&r2=751304&view=diff
==
--- tomcat/trunk/webapps/docs/config/valve.xml (original)
+++ tomcat/trunk/webapps/docs/config/valve.xml Sat Mar  7 18:45:53 2009
@@ -484,6 +484,47 @@
 
 
 
+
+
+  
+
+The HTTP specification is clear that if no character set is specified 
for
+media sub-types of the "text" media type, the ISO-8859-1 character set must
+be used. However, browsers may attempt to auto-detect the character set.
+This may be exploited by an attacker to perform an XSS attack. Internet
+Explorer has this behaviour by default. Other browsers have an option to
+enable it.
+
+This valve prevents the attack by explicitly setting a character set.
+Unless the provided character set is explicitly overridden by the user the
+browser will adhere to the explicitly set character set, thus preventing 
the
+XSS attack.
+ 

svn commit: r751313 - /tomcat/trunk/java/org/apache/catalina/connector/Response.java

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 19:42:09 2009
New Revision: 751313

URL: http://svn.apache.org/viewvc?rev=751313&view=rev
Log:
Allow the AddDefaultCharsetValve to be effective when a writer is used

Modified:
tomcat/trunk/java/org/apache/catalina/connector/Response.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/Response.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Response.java?rev=751313&r1=751312&r2=751313&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Sat Mar  7 
19:42:09 2009
@@ -811,9 +811,11 @@
 if (included)
 return; 
 
-// Ignore any call made after the getWriter has been invoked
-// The default should be used
-if (usingWriter)
+// Normally calls to this method after the getWriter has been invoked
+// will be ignored. The exception allows the addDefaultCharsetValve to
+// insert the default charset in appropriate circumstances 
+if (usingWriter && (isCharacterEncodingSet ||
+!getCharacterEncoding().equalsIgnoreCase(charset)))
 return;
 
 coyoteResponse.setCharacterEncoding(charset);



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



svn commit: r751314 - /tomcat/tc6.0.x/trunk/STATUS.txt

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 19:43:57 2009
New Revision: 751314

URL: http://svn.apache.org/viewvc?rev=751314&view=rev
Log:
Propose new valve an option to make it more effective

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=751314&r1=751313&r2=751314&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sat Mar  7 19:43:57 2009
@@ -106,3 +106,13 @@
   Align mbean with implementation
   +1: markt
   -1:
+
+* Add an AddDefaultCharsetValve
+  http://svn.apache.org/viewvc?rev=751304&view=rev
+  +1: markt
+  -1: 
+
+* Make AddDefaultCharsetValve effective when a writer is used
+  http://svn.apache.org/viewvc?rev=751313&view=rev
+  +1: markt
+  -1: 



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



svn commit: r751315 - in /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor: AbstractQueryReport.java SlowQueryReport.java StatementFinalizer.java

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 19:50:34 2009
New Revision: 751315

URL: http://svn.apache.org/viewvc?rev=751315&view=rev
Log:
Some generics fixes

Modified:

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java

tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java?rev=751315&r1=751314&r2=751315&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractQueryReport.java
 Sat Mar  7 19:50:34 2009
@@ -43,7 +43,8 @@
 /**
  * the constructors that are used to create statement proxies 
  */
-protected static final Constructor[] constructors = new 
Constructor[AbstractCreateStatementInterceptor.statements.length];
+protected static final Constructor[] constructors =
+new Constructor[AbstractCreateStatementInterceptor.statements.length];
 
 
 public AbstractQueryReport() {
@@ -147,9 +148,9 @@
  * @return - returns a constructor used to create new instances
  * @throws NoSuchMethodException
  */
-protected Constructor getConstructor(int idx, Class clazz) throws 
NoSuchMethodException {
+protected Constructor getConstructor(int idx, Class clazz) throws 
NoSuchMethodException {
 if (constructors[idx]==null) {
-Class proxyClass = 
Proxy.getProxyClass(SlowQueryReport.class.getClassLoader(), new Class[] 
{clazz});
+Class proxyClass = 
Proxy.getProxyClass(SlowQueryReport.class.getClassLoader(), new Class[] 
{clazz});
 constructors[idx] = proxyClass.getConstructor(new Class[] { 
InvocationHandler.class });
 }
 return constructors[idx];
@@ -164,7 +165,7 @@
 Object result = null;
 String name = method.getName();
 String sql = null;
-Constructor constructor = null;
+Constructor constructor = null;
 if (compare(statements[0],name)) {
 //createStatement
 constructor = getConstructor(0,Statement.class);

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=751315&r1=751314&r2=751315&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
 Sat Mar  7 19:50:34 2009
@@ -224,7 +224,7 @@
 "The date and time of the last invocation"
 };
 
-static final OpenType[] FIELD_TYPES = new OpenType[] { 
+static final OpenType[] FIELD_TYPES = new OpenType[] { 
 SimpleType.STRING,
 SimpleType.INTEGER,
 SimpleType.LONG,
@@ -258,7 +258,7 @@
 return FIELD_DESCRIPTIONS;
 }
 
-public static OpenType[] getFieldTypes() {
+public static OpenType[] getFieldTypes() {
 return FIELD_TYPES;
 }
 

Modified: 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java?rev=751315&r1=751314&r2=751315&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java
 Sat Mar  7 19:50:34 2009
@@ -39,7 +39,7 @@
 public Object createStatement(Object proxy, Method method, Object[] args, 
Object statement, long time) {
 // TODO Auto-generated method stub
 try {
-statements.add(new WeakReference((Statement)statement));
+statements.add(new WeakReference((Statement)statement));
 }catch (ClassCastException x) {
 //ignore this one
 }



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

svn commit: r751317 - /tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 19:55:10 2009
New Revision: 751317

URL: http://svn.apache.org/viewvc?rev=751317&view=rev
Log:
Clear a bunch of generics warnings in Eclipse

Modified:
tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java

Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java?rev=751317&r1=751316&r2=751317&view=diff
==
--- tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java Sat Mar  7 
19:55:10 2009
@@ -483,10 +483,12 @@
 //
 
 /** fIANA2JavaMap */
-protected final static Hashtable fIANA2JavaMap = new Hashtable();
+protected final static Hashtable fIANA2JavaMap =
+new Hashtable();
 
 /** fJava2IANAMap */
-protected final static Hashtable fJava2IANAMap = new Hashtable();
+protected final static Hashtable fJava2IANAMap =
+new Hashtable();
 
 //
 // Static initialization
@@ -946,7 +948,7 @@
 // proposed addition (see above for details):
 fJava2IANAMap.put("CP1047","IBM1047");
 
-} // ()
+}
 
 //
 // Constructors
@@ -968,7 +970,7 @@
 public static void putIANA2JavaMapping(String ianaEncoding, 
String javaEncoding) {
 fIANA2JavaMap.put(ianaEncoding, javaEncoding);
-} // putIANA2JavaMapping(String,String)
+}
 
 /**
  * Returns the Java encoding name for the specified IANA encoding name.
@@ -976,8 +978,8 @@
  * @param ianaEncoding The IANA encoding name.
  */
 public static String getIANA2JavaMapping(String ianaEncoding) {
-return (String)fIANA2JavaMap.get(ianaEncoding);
-} // getIANA2JavaMapping(String):String
+return fIANA2JavaMap.get(ianaEncoding);
+}
 
 /**
  * Removes an IANA to Java encoding name mapping.
@@ -985,8 +987,8 @@
  * @param ianaEncoding The IANA encoding name.
  */
 public static String removeIANA2JavaMapping(String ianaEncoding) {
-return (String)fIANA2JavaMap.remove(ianaEncoding);
-} // removeIANA2JavaMapping(String):String
+return fIANA2JavaMap.remove(ianaEncoding);
+}
 
 /**
  * Adds a Java to IANA encoding name mapping.
@@ -997,7 +999,7 @@
 public static void putJava2IANAMapping(String javaEncoding, 
String ianaEncoding) {
 fJava2IANAMap.put(javaEncoding, ianaEncoding);
-} // putJava2IANAMapping(String,String)
+}
 
 /**
  * Returns the IANA encoding name for the specified Java encoding name.
@@ -1005,8 +1007,8 @@
  * @param javaEncoding The Java encoding name.
  */
 public static String getJava2IANAMapping(String javaEncoding) {
-return (String)fJava2IANAMap.get(javaEncoding);
-} // getJava2IANAMapping(String):String
+return fJava2IANAMap.get(javaEncoding);
+}
 
 /**
  * Removes a Java to IANA encoding name mapping.
@@ -1014,7 +1016,7 @@
  * @param javaEncoding The Java encoding name.
  */
 public static String removeJava2IANAMapping(String javaEncoding) {
-return (String)fJava2IANAMap.remove(javaEncoding);
-} // removeJava2IANAMapping
+return fJava2IANAMap.remove(javaEncoding);
+}
 
-} // class EncodingMap
+}



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



svn commit: r751326 - in /tomcat/trunk/java/org/apache/jasper/xmlparser: TreeNode.java UTF8Reader.java XMLEncodingDetector.java

2009-03-07 Thread markt
Author: markt
Date: Sat Mar  7 20:39:58 2009
New Revision: 751326

URL: http://svn.apache.org/viewvc?rev=751326&view=rev
Log:
Fix Eclipse warnings in this package

Modified:
tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java
tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java
tomcat/trunk/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java

Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java?rev=751326&r1=751325&r2=751326&view=diff
==
--- tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/TreeNode.java Sat Mar  7 
20:39:58 2009
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Iterator;
 
 
@@ -79,7 +80,7 @@
  * The attributes of this node, keyed by attribute name,
  * Instantiated only if required.
  */
-protected HashMap attributes = null;
+protected HashMap attributes = null;
 
 
 /**
@@ -119,7 +120,7 @@
 public void addAttribute(String name, String value) {
 
 if (attributes == null)
-attributes = new HashMap();
+attributes = new HashMap();
 attributes.put(name, value);
 
 }
@@ -148,9 +149,9 @@
 public String findAttribute(String name) {
 
 if (attributes == null)
-return (null);
+return null;
 else
-return ((String) attributes.get(name));
+return attributes.get(name);
 
 }
 
@@ -159,12 +160,13 @@
  * Return an Iterator of the attribute names of this node.  If there are
  * no attributes, an empty Iterator is returned.
  */
-public Iterator findAttributes() {
+public Iterator findAttributes() {
 
-if (attributes == null)
-return (Collections.EMPTY_LIST.iterator());
-else
-return (attributes.keySet().iterator());
+if (attributes == null) {
+List empty = Collections.emptyList(); 
+return empty.iterator();
+} else
+return attributes.keySet().iterator();
 
 }
 
@@ -179,9 +181,9 @@
 
 if (children == null)
 return (null);
-Iterator items = children.iterator();
+Iterator items = children.iterator();
 while (items.hasNext()) {
-TreeNode item = (TreeNode) items.next();
+TreeNode item = items.next();
 if (name.equals(item.getName()))
 return (item);
 }
@@ -196,10 +198,11 @@
  */
 public Iterator findChildren() {
 
-if (children == null)
-return (Collections.EMPTY_LIST.iterator());
-else
-return (children.iterator());
+if (children == null) {
+List empty = Collections.emptyList(); 
+return empty.iterator();
+} else
+return children.iterator();
 
 }
 
@@ -213,8 +216,10 @@
  */
 public Iterator findChildren(String name) {
 
-if (children == null)
-return (Collections.EMPTY_LIST.iterator());
+if (children == null) {
+List empty = Collections.emptyList(); 
+return empty.iterator();
+} 
 
 ArrayList results = new ArrayList();
 Iterator items = children.iterator();
@@ -319,10 +324,10 @@
 sb.append(' ');
 sb.append('<');
 sb.append(node.getName());
-Iterator names = node.findAttributes();
+Iterator names = node.findAttributes();
 while (names.hasNext()) {
 sb.append(' ');
-String name = (String) names.next();
+String name = names.next();
 sb.append(name);
 sb.append("=\"");
 String value = node.findAttribute(name);
@@ -341,9 +346,9 @@
 }
 
 // Reconstruct child nodes with extra indentation
-Iterator children = node.findChildren();
+Iterator children = node.findChildren();
 while (children.hasNext()) {
-TreeNode child = (TreeNode) children.next();
+TreeNode child = children.next();
 toString(sb, indent2, child);
 }
 

Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java?rev=751326&r1=751325&r2=751326&view=diff
==
--- tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java Sat Mar  7 
20:39:58 2009
@@ -126,7 +126,7 @@
 expectedByte(2, 2);
 }
 if ((b1 & 0xC0) != 0x80) {

Re: svn commit: r751304 - in /tomcat/trunk: java/org/apache/catalina/valves/AddDefaultCharsetValve.java webapps/docs/config/valve.xml

2009-03-07 Thread Bill Barker

 wrote in message 
news:20090307184553.971be2388...@eris.apache.org...
> Author: markt
> Date: Sat Mar  7 18:45:53 2009
> New Revision: 751304
>
> URL: http://svn.apache.org/viewvc?rev=751304&view=rev
> Log:
> Add AddDefaultCharSetValve
>
> Added:
> 
> tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java 
> (with props)
> Modified:
>tomcat/trunk/webapps/docs/config/valve.xml
>
> Added: 
> tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java?rev=751304&view=auto
> ==
> +public class AddDefaultCharsetValve
> +extends ValveBase {
> +
> +/**
> + * Check for text/* and no character set and set charset to 
> ISO-8859-1 in
> + * those circumstances.
> + */
> +public void invoke(Request request, Response response)
> +throws IOException, ServletException {
> +
> +// Process the request first
> +getNext().invoke(request, response);

This means that 99% of the time, this valve does nothing (except possibly 
putting bogus values in the log files), since the response is already 
committed.

> +
> +// Test once the response has been generated
> +String ct = response.getContentType();
> +if (ct != null && ct.startsWith("text/")) {
> +// Make sure the charset is explicitly set
> + 
> response.setCharacterEncoding(response.getCharacterEncoding());
> +}
> +}
> +
> +}
>
> Propchange: 
> tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java
> --
>svn:eol-style = native
>
> Propchange: 
> tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java
> --
>svn:keywords = Date Author Id Revision
>
> Modified: tomcat/trunk/webapps/docs/config/valve.xml
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/valve.xml?rev=751304&r1=751303&r2=751304&view=diff
> ==
> --- tomcat/trunk/webapps/docs/config/valve.xml (original)
> +++ tomcat/trunk/webapps/docs/config/valve.xml Sat Mar  7 18:45:53 2009
> @@ -484,6 +484,47 @@
> 
>
>
> +
> +
> +  
> +
> +The HTTP specification is clear that if no character set is 
> specified for
> +media sub-types of the "text" media type, the ISO-8859-1 character 
> set must
> +be used. However, browsers may attempt to auto-detect the character 
> set.
> +This may be exploited by an attacker to perform an XSS attack. 
> Internet
> +Explorer has this behaviour by default. Other browsers have an option 
> to
> +enable it.
> +
> +This valve prevents the attack by explicitly setting a character 
> set.
> +Unless the provided character set is explicitly overridden by the 
> user the
> +browser will adhere to the explicitly set character set, thus 
> preventing the
> +XSS attack.
> +
> +This Valve may be used at the Engine, 
> Host or
> +Context level as required. Normally, this Valve would be 
> used
> +at the Engine level.
> +
> +  
> +
> +  
> +
> +The Add Default Character Set Valve supports the
> +following configuration attributes:
> +
> +
> +
> +  
> +Java class name of the implementation to use.  This MUST be 
> set to
> + 
> org.apache.catalina.valves.AddDefaultCharsetValve.
> +  
> +
> +
> +
> +  
> +
> +
> +
> +
>  




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



Re: svn commit: r751304 - in /tomcat/trunk: java/org/apache/catalina/valves/AddDefaultCharsetValve.java webapps/docs/config/valve.xml

2009-03-07 Thread Filip Hanik - Dev Lists

Bill Barker wrote:
 wrote in message 
news:20090307184553.971be2388...@eris.apache.org...
  

Author: markt
Date: Sat Mar  7 18:45:53 2009
New Revision: 751304

URL: http://svn.apache.org/viewvc?rev=751304&view=rev
Log:
Add AddDefaultCharSetValve

Added:

tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java 
(with props)

Modified:
   tomcat/trunk/webapps/docs/config/valve.xml

Added: 
tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java?rev=751304&view=auto

==
+public class AddDefaultCharsetValve
+extends ValveBase {
+
+/**
+ * Check for text/* and no character set and set charset to 
ISO-8859-1 in

+ * those circumstances.
+ */
+public void invoke(Request request, Response response)
+throws IOException, ServletException {
+
+// Process the request first
+getNext().invoke(request, response);



This means that 99% of the time, this valve does nothing (except possibly 
putting bogus values in the log files), since the response is already 
committed.
  
maybe better to implement it as a filter with a response wrapper, that 
reacts to setContentType


Filip
  

+
+// Test once the response has been generated
+String ct = response.getContentType();
+if (ct != null && ct.startsWith("text/")) {
+// Make sure the charset is explicitly set
+ 
response.setCharacterEncoding(response.getCharacterEncoding());

+}
+}
+
+}

Propchange: 
tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java

--
   svn:eol-style = native

Propchange: 
tomcat/trunk/java/org/apache/catalina/valves/AddDefaultCharsetValve.java

--
   svn:keywords = Date Author Id Revision

Modified: tomcat/trunk/webapps/docs/config/valve.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/valve.xml?rev=751304&r1=751303&r2=751304&view=diff

==
--- tomcat/trunk/webapps/docs/config/valve.xml (original)
+++ tomcat/trunk/webapps/docs/config/valve.xml Sat Mar  7 18:45:53 2009
@@ -484,6 +484,47 @@



+
+
+  
+
+The HTTP specification is clear that if no character set is 
specified for
+media sub-types of the "text" media type, the ISO-8859-1 character 
set must
+be used. However, browsers may attempt to auto-detect the character 
set.
+This may be exploited by an attacker to perform an XSS attack. 
Internet
+Explorer has this behaviour by default. Other browsers have an option 
to

+enable it.
+
+This valve prevents the attack by explicitly setting a character 
set.
+Unless the provided character set is explicitly overridden by the 
user the
+browser will adhere to the explicitly set character set, thus 
preventing the

+XSS attack.
+
+This Valve may be used at the Engine, 
Host or
+Context level as required. Normally, this Valve would be 
used

+at the Engine level.
+
+  
+
+  
+
+The Add Default Character Set Valve supports the
+following configuration attributes:
+
+
+
+  
+Java class name of the implementation to use.  This MUST be 
set to
+ 
org.apache.catalina.valves.AddDefaultCharsetValve.

+  
+
+
+
+  
+
+
+
+
 






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


  



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



DO NOT REPLY [Bug 46819] New: Remove redundant object instantiations in JspRuntimeLibrary

2009-03-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=46819

   Summary: Remove redundant object instantiations in
JspRuntimeLibrary
   Product: Tomcat 6
   Version: 6.0.18
  Platform: PC
OS/Version: Windows Vista
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Jasper
AssignedTo: dev@tomcat.apache.org
ReportedBy: anth...@whitford.com


Created an attachment (id=23353)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23353)
Patch file to replace new with valueOf, and some valueOf with parse

While perusing the code, I noticed that
java\org\apache\jasper\runtime\JspRuntimeLibrary.java code was doing a few
things that I think can be improved:

1.  coerce methods were instantiating new objects, only to convert them to
primitives.  For example:

return Boolean.valueOf(s).booleanValue();

This can be rewritten (and simplified) as:

return Boolean.parseBoolean(s);

This pattern was repeated for numerous primitive types.


2.  Objects were being instantiated using new instead of calling valueOf.  For
example:

return new Byte((byte) 0);

instead of:

return Byte.valueOf((byte) 0);

According to the Java API, valueOf should generally be used in preference to
the constructor as this method is likely to yield significantly better space
and time performance.

3.  toString methods are instantiating a temporary object just to turn it into
a string value.  For example:

return new Integer(i).toString();

This can be rewritten (and simplified) as:

return Integer.toString(i);

This pattern was repeated for numerous primitive types.


I took the liberty of creating a patch.  These changes should yield improved
performance and reduce the memory footprint.

-- 
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