[Bug 55552] New: Potential NullPointerException in compiled JSPs if expected result is of primitive type

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=2

Bug ID: 2
   Summary: Potential NullPointerException in compiled JSPs if
expected result is of primitive type
   Product: Tomcat 8
   Version: 8.0.0-RC1
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: Jasper
  Assignee: dev@tomcat.apache.org
  Reporter: arvids.grabovs...@gmail.com

Created attachment 30821
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=30821action=edit
Web application with required libraries and JSP file to repredouce the NPE

If JSP includes a line c:if test=${nonExisting}Hello,world!/c:if where
nonExisting is attribute that does not exist, then NullPointerException will
be thrown. The cause is at org.apache.jasper.compiler.JspUtil.java at line #421
which generates something like:
((java.lang.Boolean)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(${nonExisting},
java.lang.Boolean.class, (javax.servlet.jsp.PageContext)_jspx_page_context,
null, false)).booleanValue()

The result of proprietaryEvaluate() is null (because of EL 3.0 changes
regarding coercing), hence calling booleanValue() will throw NPE. The latest
changes in EL specification does require guarding against such null pointer
access (otherwise it will break lots of existing applications). I really hope
that NPE is not intended behavior.

Steps to reproduce:
* put jstl 1.2+ required jar files in WEB-INF/lib (or tomcat/lib)
* Create a simple JSP file with line above (c:if
test=${nonExisting}Hello,world!/c:if)
* Exception is thrown upon invoking jsp:
java.lang.NullPointerException
org.apache.jsp.index_jsp._jspx_meth_c_005fif_005f0(index_jsp.java:109)
org.apache.jsp.index_jsp._jspService(index_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:91)

As far as I understand, this is direct result of incompatibility between EL 3.0
(http://download.oracle.com/otndocs/jcp/el-3_0-fr-eval-spec/index.html) and 2.2
as stated in EL spec this is intended behavior of EL. Here's the citation
(Section A.4):
The default coercion for nulls to non-primitive types (except String) returns 
nulls. For instance, a null coerced to Boolean now returns a null, while a 
null coerced to boolean returns false.

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



[Bug 55552] Potential NullPointerException in compiled JSPs if expected EL result is of primitive type

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=2

Arvīds Grabovskis arvids.grabovs...@gmail.com changed:

   What|Removed |Added

Summary|Potential   |Potential
   |NullPointerException in |NullPointerException in
   |compiled JSPs if expected   |compiled JSPs if expected
   |result is of primitive type |EL result is of primitive
   ||type
 OS||All

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



[Bug 55553] New: Proposal: Allow org.apache.catalina.valves.RemoteIpValve to set requests as secure with a transparent SSL termination proxy

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=3

Bug ID: 3
   Summary: Proposal: Allow
org.apache.catalina.valves.RemoteIpValve to set
requests as secure with a transparent SSL termination
proxy
   Product: Tomcat 7
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: k...@ytterhaug.com

Created attachment 30822
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=30822action=edit
Patch for RemoteIpValve.java

I've created a patch for org.apache.catalina.valves.RemoteIpValve which will
allow configuring the Valve to set requests as secure based on the
protocolHeader and protocolHeaderHttpsValue when RemoteAddr is the actual IP
for the client and not a known Proxy.

This is useful when having a transparent SSL termination proxy which is only
setting an x-forwarded-proto header and is not changing RemoteAddr or adding an
x-forwarded-for header.

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



Tomcat 7 build is broken on a local PC

2013-09-12 Thread Violeta Georgieva
Hi,

Although I can see that the central build is OK, I cannot build tomcat 7
trunk.

The new class org.apache.tomcat.util.buf.Utf8Encoder
uses java.nio.charset.StandardCharsets which is available only in java 7.

Do you have such problems?

Thanks
Violeta


Re: Tomcat 7 build is broken on a local PC

2013-09-12 Thread Mark Thomas
On 12/09/2013 08:55, Violeta Georgieva wrote:
 Hi,
 
 Although I can see that the central build is OK, I cannot build tomcat 7
 trunk.
 
 The new class org.apache.tomcat.util.buf.Utf8Encoder
 uses java.nio.charset.StandardCharsets which is available only in java 7.
 
 Do you have such problems?

That needs fixing to use the constant.

Mark


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



Re: Tomcat 7 build is broken on a local PC

2013-09-12 Thread Mark Thomas
On 12/09/2013 09:00, Mark Thomas wrote:
 On 12/09/2013 08:55, Violeta Georgieva wrote:
 Hi,

 Although I can see that the central build is OK, I cannot build tomcat 7
 trunk.

 The new class org.apache.tomcat.util.buf.Utf8Encoder
 uses java.nio.charset.StandardCharsets which is available only in java 7.

 Do you have such problems?
 
 That needs fixing to use the constant.

There is also a problem with the build process. Too many files are being
compiled with Java 7 rather than Java 6. I'm investigating now...

Mark


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



svn commit: r1522491 - /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 08:55:00 2013
New Revision: 1522491

URL: http://svn.apache.org/r1522491
Log:
Remove Java 7 dependency that was missed in back-port

Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java?rev=1522491r1=1522490r2=1522491view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/Utf8Encoder.java Thu 
Sep 12 08:55:00 2013
@@ -20,7 +20,6 @@ import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
-import java.nio.charset.StandardCharsets;
 
 /**
  * Encodes characters as bytes using UTF-8. Extracted from Apache Harmony with
@@ -29,7 +28,7 @@ import java.nio.charset.StandardCharsets
 public class Utf8Encoder extends CharsetEncoder {
 
 public Utf8Encoder() {
-super(StandardCharsets.UTF_8, 1.1f, 4.0f);
+super(B2CConverter.UTF_8, 1.1f, 4.0f);
 }
 
 @Override



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



svn commit: r1522492 - /tomcat/tc7.0.x/trunk/build.xml

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 08:56:49 2013
New Revision: 1522492

URL: http://svn.apache.org/r1522492
Log:
Ensure that only the web socket implementation classes are compiled with Java 
7. This is done by making sure everything else is compiled first with Java 6.

Modified:
tomcat/tc7.0.x/trunk/build.xml

Modified: tomcat/tc7.0.x/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/build.xml?rev=1522492r1=1522491r2=1522492view=diff
==
--- tomcat/tc7.0.x/trunk/build.xml (original)
+++ tomcat/tc7.0.x/trunk/build.xml Thu Sep 12 08:56:49 2013
@@ -572,8 +572,10 @@
 /copy
   /target
 
-  target name=compile
-  
depends=build-prepare,download-compile,compile-prepare,validate,compile-java7
+  target name=compile depends=compile-java6,compile-java7 /
+
+  target name=compile-java6
+  depends=build-prepare,download-compile,compile-prepare,validate
 !-- Compile internal server components --
 javac srcdir=java destdir=${tomcat.classes}
debug=${compile.debug}
@@ -604,10 +606,8 @@
 
   /target
 
-  target name=compile-java7
-  depends=build-prepare,download-compile,compile-prepare,validate
-  if=java.7.home 
-javac srcdir=java destdir=${tomcat.classes}
+  target name=compile-java7 depends=compile-java6 if=java.7.home 
+javac sourcepath= srcdir=java destdir=${tomcat.classes}
debug=${compile.debug}
deprecation=${compile.deprecation}
source=${compile.source}



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



[Bug 55553] Proposal: Allow org.apache.catalina.valves.RemoteIpValve to set requests as secure with a transparent SSL termination proxy

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=3

Mark Thomas ma...@apache.org changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #1 from Mark Thomas ma...@apache.org ---
In that case why can't you just set secure on the connector?

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

2013-09-12 Thread kfujino
Author: kfujino
Date: Thu Sep 12 09:28:53 2013
New Revision: 1522501

URL: http://svn.apache.org/r1522501
Log:
The loaded attribute never exists in PersistentManager. 
isLoaded is defined as operation in mbeans-descriptors. 

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=1522501r1=1522500r2=1522501view=diff
==
--- tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml Thu 
Sep 12 09:28:53 2013
@@ -232,11 +232,6 @@
   description=Number of sessions that expired ( doesn't include 
explicit invalidations )
  type=long /
 
-attribute   name=loaded
-  description=If the session id is loaded in memory?
- type=boolean
-   writeable = false /
-
 attribute   name=jvmRoute
   description=Retrieve the JvmRoute for the enclosing Engine
  type=java.lang.String
@@ -395,6 +390,15 @@
returnType=java.lang.String
 /operation
 
+operation   name=isLoaded
+  description=If the session id is loaded in memory?
+   impact=ACTION
+   returnType=booelan
+  parameter name=sessionId
+  description=Id of the session
+ type=java.lang.String/
+/operation
+
   /mbean
 
 /mbeans-descriptors



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



svn commit: r1522502 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/session/mbeans-descriptors.xml webapps/docs/changelog.xml

2013-09-12 Thread kfujino
Author: kfujino
Date: Thu Sep 12 09:34:02 2013
New Revision: 1522502

URL: http://svn.apache.org/r1522502
Log:
The loaded attribute never exists in PersistentManager. 
isLoaded is defined as operation in mbeans-descriptors. 

Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml?rev=1522502r1=1522501r2=1522502view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml 
Thu Sep 12 09:34:02 2013
@@ -232,11 +232,6 @@
   description=Number of sessions that expired ( doesn't include 
explicit invalidations )
  type=long /
  
-attribute   name=loaded
-  description=If the session id is loaded in memory?
- type=boolean
-   writeable = false /
- 
 attribute   name=jvmRoute
   description=Retrieve the JvmRoute for the enclosing Engine
  type=java.lang.String
@@ -395,6 +390,15 @@
returnType=java.lang.String
 /operation
 
+operation   name=isLoaded
+  description=If the session id is loaded in memory?
+   impact=ACTION
+   returnType=booelan
+  parameter name=sessionId
+  description=Id of the session
+ type=java.lang.String/
+/operation
+
   /mbean
 
 /mbeans-descriptors

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1522502r1=1522501r2=1522502view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Sep 12 09:34:02 2013
@@ -166,6 +166,10 @@
 codeIOException/code during output when using Tomcatapos;
 proprietary (and deprecated) WebSocket API. (markt)
   /fix
+  fix
+The loaded attribute never exists in codePersistentManager/code.
+isLoaded is defined as operation in mbeans-descriptors. (kfujino)
+  /fix
 /changelog
   /subsection
   subsection name=Coyote



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



svn commit: r1522504 - /tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 09:38:10 2013
New Revision: 1522504

URL: http://svn.apache.org/r1522504
Log:
Fix some Javadoc

Modified:
tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java?rev=1522504r1=1522503r2=1522504view=diff
==
--- tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java Thu Sep 12 
09:38:10 2013
@@ -921,9 +921,9 @@ public class JspUtil {
 }
 
 /**
- * Class.getName() return arrays in the form [[[et, where et, the
- * element type can be one of ZBCDFIJS or Lclassname; It is converted
- * into forms that can be understood by javac.
+ * Class.getName() return arrays in the form [[[lt;etgt;, where et, the
+ * element type can be one of ZBCDFIJS or Llt;classnamegt;;. It is
+ * converted into forms that can be understood by javac.
  */
 public static String toJavaSourceType(String type) {
 



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



svn commit: r1522505 - /tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 09:39:15 2013
New Revision: 1522505

URL: http://svn.apache.org/r1522505
Log:
Remove unused code.

Modified:
tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java?rev=1522505r1=1522504r2=1522505view=diff
==
--- tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 
(original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspRuntimeLibrary.java Thu Sep 
12 09:39:15 2013
@@ -582,27 +582,6 @@ public class JspRuntimeLibrary {
 // __end lookupReadMethodMethod
 
 // handles jsp:setProperty with EL expression for 'value' attribute
-/** Use proprietaryEvaluate
-public static void handleSetPropertyExpression(Object bean,
-String prop, String expression, PageContext pageContext,
-VariableResolver variableResolver, FunctionMapper functionMapper )
-throws JasperException
-{
-try {
-Method method = getWriteMethod(bean.getClass(), prop);
-method.invoke(bean, new Object[] {
-pageContext.getExpressionEvaluator().evaluate(
-expression,
-method.getParameterTypes()[0],
-variableResolver,
-functionMapper,
-null )
-});
-} catch (Exception ex) {
-throw new JasperException(ex);
-}
-}
-**/
 public static void handleSetPropertyExpression(Object bean,
 String prop, String expression, PageContext pageContext,
 ProtectedFunctionMapper functionMapper )



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



svn commit: r1522512 - /tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 10:06:16 2013
New Revision: 1522512

URL: http://svn.apache.org/r1522512
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=2
Separate the return type (which must be an object) from the expected type which 
may be a primitive. This is necessary for EL 3.0 onwards as the default 
handling of nulls is now different for primitives and objects. The expression 
engine needs to know what the true expected type is in order to correctly 
coerce the result to the right type.

Modified:
tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java?rev=1522512r1=1522511r2=1522512view=diff
==
--- tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspUtil.java Thu Sep 12 
10:06:16 2013
@@ -357,32 +357,33 @@ public class JspUtil {
  * Determine whether to use the expected type's textual name or, if 
it's
  * a primitive, the name of its correspondent boxed type.
  */
-String targetType = expectedType.getCanonicalName();
+String returnType = expectedType.getCanonicalName();
+String targetType = returnType;
 String primitiveConverterMethod = null;
 if (expectedType.isPrimitive()) {
 if (expectedType.equals(Boolean.TYPE)) {
-targetType = Boolean.class.getName();
+returnType = Boolean.class.getName();
 primitiveConverterMethod = booleanValue;
 } else if (expectedType.equals(Byte.TYPE)) {
-targetType = Byte.class.getName();
+returnType = Byte.class.getName();
 primitiveConverterMethod = byteValue;
 } else if (expectedType.equals(Character.TYPE)) {
-targetType = Character.class.getName();
+returnType = Character.class.getName();
 primitiveConverterMethod = charValue;
 } else if (expectedType.equals(Short.TYPE)) {
-targetType = Short.class.getName();
+returnType = Short.class.getName();
 primitiveConverterMethod = shortValue;
 } else if (expectedType.equals(Integer.TYPE)) {
-targetType = Integer.class.getName();
+returnType = Integer.class.getName();
 primitiveConverterMethod = intValue;
 } else if (expectedType.equals(Long.TYPE)) {
-targetType = Long.class.getName();
+returnType = Long.class.getName();
 primitiveConverterMethod = longValue;
 } else if (expectedType.equals(Float.TYPE)) {
-targetType = Float.class.getName();
+returnType = Float.class.getName();
 primitiveConverterMethod = floatValue;
 } else if (expectedType.equals(Double.TYPE)) {
-targetType = Double.class.getName();
+returnType = Double.class.getName();
 primitiveConverterMethod = doubleValue;
 }
 }
@@ -408,7 +409,7 @@ public class JspUtil {
 targetType = toJavaSourceType(targetType);
 StringBuilder call = new StringBuilder(
 (
-+ targetType
++ returnType
 + ) 
 + 
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate
 + ( + Generator.quote(expression) + ,  + targetType



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



[Bug 55553] Proposal: Allow org.apache.catalina.valves.RemoteIpValve to set requests as secure with a transparent SSL termination proxy

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=3

--- Comment #2 from Knut Ytterhaug k...@ytterhaug.com ---
We need our tomcats to be able to serve the same content both on http and https
and would like our applications to be able to use request.isSecure() to handle
redirects etc accordingly.

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



[Bug 55552] Potential NullPointerException in compiled JSPs if expected EL result is of primitive type

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=2

Mark Thomas ma...@apache.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Mark Thomas ma...@apache.org ---
The change in default handling for non-primitive types did trigger this bug.
The problem was that Jasper was converting primitive expected types to the
object versions before calling the expression engine. This has been fixed and
now Jasper passes exactly the type requested.

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



[Bug 55553] Proposal: Allow org.apache.catalina.valves.RemoteIpValve to set requests as secure with a transparent SSL termination proxy

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=3

Mark Thomas ma...@apache.org changed:

   What|Removed |Added

 Status|NEEDINFO|RESOLVED
 Resolution|--- |WONTFIX

--- Comment #3 from Mark Thomas ma...@apache.org ---
Then the solution is to configure two http connectors on separate ports: one
for direct http traffic and one for http traffic that has been processed by the
transparent proxy.

If you want the http and https requests to share a common thread pool then an
executor can be configured.

The proposed patch would result in the the valve processing headers when no
trusted proxy had been configured and I am concerned that some users may be
caught out by this and end up with an insecure configuration - even if this
behavior is documented.

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



[Bug 55553] Proposal: Allow org.apache.catalina.valves.RemoteIpValve to set requests as secure with a transparent SSL termination proxy

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=3

--- Comment #4 from Knut Ytterhaug k...@ytterhaug.com ---
Thanks for the quick answers. Unfortunately (for us) we're unable to configure
using different connectors depending on if it's been processed or not.

Would a patch adding a boolean property making the valve process headers when
no trusted proxy had been configured be considered?

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



[Bug 55553] Proposal: Allow org.apache.catalina.valves.RemoteIpValve to set requests as secure with a transparent SSL termination proxy

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=3

--- Comment #5 from Mark Thomas ma...@apache.org ---
(In reply to Knut Ytterhaug from comment #4)
 Thanks for the quick answers. Unfortunately (for us) we're unable to
 configure using different connectors depending on if it's been processed or
 not.

 Would a patch adding a boolean property making the valve process headers
 when no trusted proxy had been configured be considered?

Unlikely.

As an aside, any changes to the Valve need to mirrored to the Filter.

The users list is the best place to figure out a solution that works for you.
I'd be surprised if one wasn't available with existing configuration. Saying
which proxy you are using would help.

-- 
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: r1522526 - in /tomcat/trunk: java/org/apache/catalina/valves/CometConnectionManagerValve.java webapps/docs/changelog.xml

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 11:16:15 2013
New Revision: 1522526

URL: http://svn.apache.org/r1522526
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52558
Refactor CometConnectionManagerValve so that it does not prevent the session 
from being serialized in when running in a cluster. 

Modified:

tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java?rev=1522526r1=1522525r2=1522526view=diff
==
--- 
tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java 
(original)
+++ 
tomcat/trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java 
Thu Sep 12 11:16:15 2013
@@ -18,6 +18,7 @@ package org.apache.catalina.valves;
 
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -177,13 +178,17 @@ public class CometConnectionManagerValve
 
 // Track the connection for session expiration
 synchronized (session) {
-Request[] requests = (Request[])
-session.getAttribute(cometRequestsAttribute);
+ConnectionList list = (ConnectionList) session.getAttribute(
+cometRequestsAttribute);
+Request[] requests = null;
+if (list != null) {
+requests = list.get();
+}
 if (requests == null) {
 requests = new Request[1];
 requests[0] = request;
 session.setAttribute(cometRequestsAttribute,
-requests);
+new ConnectionList(requests));
 } else {
 Request[] newRequests =
 new Request[requests.length + 1];
@@ -191,7 +196,8 @@ public class CometConnectionManagerValve
 newRequests[i] = requests[i];
 }
 newRequests[requests.length] = request;
-session.setAttribute(cometRequestsAttribute, newRequests);
+session.setAttribute(cometRequestsAttribute,
+new ConnectionList(newRequests));
 }
 }
 }
@@ -235,8 +241,12 @@ public class CometConnectionManagerValve
 synchronized (session) {
 Request[] reqs = null;
 try {
- reqs = (Request[])
-session.getAttribute(cometRequestsAttribute);
+ConnectionList list =
+(ConnectionList) session.getAttribute(
+cometRequestsAttribute);
+if (list != null) {
+reqs = list.get();
+}
 } catch (IllegalStateException ise) {
 // Ignore - session has been invalidated
 // Listener will have cleaned up
@@ -259,7 +269,8 @@ public class CometConnectionManagerValve
 try {
 session.setAttribute(
 cometRequestsAttribute,
-newConnectionInfos);
+new ConnectionList(
+newConnectionInfos));
 } catch (IllegalStateException ise) {
 // Ignore - session has been 
invalidated
 // Listener will have cleaned up
@@ -292,8 +303,12 @@ public class CometConnectionManagerValve
 @Override
 public void sessionDestroyed(HttpSessionEvent se) {
 // Close all Comet connections associated with this session
-Request[] reqs = (Request[])
-se.getSession().getAttribute(cometRequestsAttribute);
+ConnectionList list = (ConnectionList) se.getSession().getAttribute(
+cometRequestsAttribute);
+Request[] reqs = null;
+if (list != null) {
+reqs = list.get();
+}
 if (reqs != null) {
 for (int i = 0; i  reqs.length; i++) {
 Request req = reqs[i];
@@ -312,4 +327,19 @@ public class CometConnectionManagerValve
 }
 }
 
+
+private static class ConnectionList implements Serializable {
+
+private static final long serialVersionUID = 

[Bug 52558] CometConnectionManagerValve is adding non-serializable Request[] to Session

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52558

Mark Thomas ma...@apache.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
  Component|Catalina|Catalina
Version|7.0.22  |8.0.0-RC1
 Resolution|--- |FIXED
Product|Tomcat 7|Tomcat 8
   Target Milestone|--- |

--- Comment #2 from Mark Thomas ma...@apache.org ---
I'd be surprised if anyone was relying on the connection list being stored as
an array of requests but in case they are it is safer to use the work=around
for 7.0.x and earlier. I have applied a fix based on the suggested new class
for Tomcat 8.

-- 
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: r1522563 - /tomcat/trunk/java/org/apache/catalina/connector/Request.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 13:15:38 2013
New Revision: 1522563

URL: http://svn.apache.org/r1522563
Log:
Apply clarification from the Servlet EG.
Attempting to parse parts when no multi-part configuration has been provided 
will trigger an ISE.

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

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1522563r1=1522562r2=1522563view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Thu Sep 12 
13:15:38 2013
@@ -2535,7 +2535,7 @@ public class Request
 public CollectionPart getParts() throws IOException, 
IllegalStateException,
 ServletException {
 
-parseParts();
+parseParts(true);
 
 if (partsParseException != null) {
 if (partsParseException instanceof IOException) {
@@ -2550,7 +2550,7 @@ public class Request
 return parts;
 }
 
-private void parseParts() {
+private void parseParts(boolean explicit) {
 
 // Return immediately if the parts have already been parsed
 if (parts != null || partsParseException != null) {
@@ -2566,8 +2566,14 @@ public class Request
  connector.getMaxPostSize(),
  connector.getMaxPostSize());
 } else {
-parts = Collections.emptyList();
-return;
+if (explicit) {
+partsParseException = new IllegalStateException(
+sm.getString(coyoteRequest.noMultipartConfig));
+return;
+} else {
+parts = Collections.emptyList();
+return;
+}
 }
 }
 
@@ -2928,7 +2934,7 @@ public class Request
 }
 
 if (multipart/form-data.equals(contentType)) {
-parseParts();
+parseParts(false);
 success = true;
 return;
 }



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



svn commit: r1522576 - in /tomcat/trunk/java: javax/servlet/http/HttpServletRequest.java org/apache/catalina/connector/LocalStrings.properties

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 13:40:46 2013
New Revision: 1522576

URL: http://svn.apache.org/r1522576
Log:
Apply clarification from the Servlet EG.
Attempting to parse parts when no multi-part configuration has been provided 
will trigger an ISE.

Modified:
tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java
tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties

Modified: tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java?rev=1522576r1=1522575r2=1522576view=diff
==
--- tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java (original)
+++ tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java Thu Sep 12 
13:40:46 2013
@@ -477,7 +477,8 @@ public interface HttpServletRequest exte
  * @throws IOException
  * if an I/O error occurs
  * @throws IllegalStateException
- * if size limits are exceeded
+ * if size limits are exceeded or no multipart configuration is
+ * provided
  * @throws ServletException
  * if the request is not multipart/form-data
  * @since Servlet 3.0

Modified: 
tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=1522576r1=1522575r2=1522576view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties Thu 
Sep 12 13:40:46 2013
@@ -47,6 +47,7 @@ coyoteRequest.uploadLocationInvalid=The 
 coyoteRequest.sessionEndAccessFail=Exception triggered ending access to 
session while recycling request
 coyoteRequest.sendfileNotCanonical=Unable to determine canonical name of file 
[{0}] specified for use with sendfile
 coyoteRequest.maxPostSizeExceeded=The multi-part request contained parameter 
data (excluding uploaded files) that exceeded the limit for maxPostSize set on 
the associated connector
+coyoteRequest.noMultipartConfig=Unable to process parts as no multi-part 
configuration has been provided
 
 coyoteResponse.getOutputStream.ise=getWriter() has already been called for 
this response
 coyoteResponse.getWriter.ise=getOutputStream() has already been called for 
this response



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



buildbot failure in ASF Buildbot on tomcat-trunk

2013-09-12 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/tomcat-trunk/builds/4956

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1522563
Blamelist: markt

BUILD FAILED: failed compile_1

sincerely,
 -The Buildbot





svn commit: r1522587 - /tomcat/trunk/java/org/apache/catalina/connector/Request.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 14:14:15 2013
New Revision: 1522587

URL: http://svn.apache.org/r1522587
Log:
Be consistent about how secure is accessed

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

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1522587r1=1522586r2=1522587view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Thu Sep 12 
14:14:15 2013
@@ -2373,7 +2373,7 @@ public class Request
 if (response != null) {
 Cookie newCookie =
 ApplicationSessionCookieConfig.createSessionCookie(context,
-newSessionId, secure);
+newSessionId, isSecure());
 response.addSessionCookieInternal(newCookie);
 }
 }



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



[Bug 53602] Support for HTTP status code 451

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53602

Mark Thomas ma...@apache.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |LATER

--- Comment #4 from Mark Thomas ma...@apache.org ---
This (and any other new codes) can be added once they are approved.

-- 
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: r1522594 - /tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 14:25:31 2013
New Revision: 1522594

URL: http://svn.apache.org/r1522594
Log:
Update unit tests to align with changes in part parsing without configuration 
(now throws ISE)

Modified:
tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java

Modified: tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java?rev=1522594r1=1522593r2=1522594view=diff
==
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java Thu Sep 
12 14:25:31 2013
@@ -672,9 +672,8 @@ public class TestStandardContext extends
 // Make sure non-multipart works properly
 client.doRequest(/regular, false, false);
 
-assertEquals(Incorrect response for GET request,
- parts=0,
- client.getResponseBody());
+// Servlet attempts to read parts which will trigger an ISE
+assertTrue(client.isResponse500());
 
 client.reset();
 
@@ -688,12 +687,11 @@ public class TestStandardContext extends
 client.reset();
 
 // Make casual multipart request to regular servlet w/o config
-// We expect that no parts will be available
+// We expect an error
 client.doRequest(/regular, false, true); // send multipart request
 
-assertEquals(Incorrect response for non-configured casual multipart 
request,
- parts=0, // multipart request should be ignored
- client.getResponseBody());
+// Servlet attempts to read parts which will trigger an ISE
+assertTrue(client.isResponse500());
 
 client.reset();
 



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



[Bug 55383] Improve markup and design of Tomcat's HTML pages

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55383

--- Comment #42 from Konstantin Preißer prei...@web.de ---
Created attachment 30824
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=30824action=edit
Updated Tomcat Site XMLs

Hi,

this patch improves the markup in the Tomcat Site XMLs. After applying, the
HTMls should validate against a HTML5 validator.

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



buildbot success in ASF Buildbot on tomcat-trunk

2013-09-12 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/tomcat-trunk/builds/4958

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1522594
Blamelist: markt

Build succeeded!

sincerely,
 -The Buildbot





svn commit: r1522615 - /tomcat/trunk/webapps/docs/changelog.xml

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 15:26:00 2013
New Revision: 1522615

URL: http://svn.apache.org/r1522615
Log:
Fix trailing whitespace

Modified:
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1522615r1=1522614r2=1522615view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Sep 12 15:26:00 2013
@@ -93,7 +93,7 @@
   fix
 bug52558/bug: Refactor codeCometConnectionManagerValve/code so
 that it does not prevent the session from being serialized in when
-running in a cluster. (markt) 
+running in a cluster. (markt)
   /fix
   fix
 bug52767/bug: Remove reference to MySQL specific autoReconnect



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



Where to put a helper class for test?

2013-09-12 Thread Nick Williams
Mark,

I'm working on revisions to my patch for BZ 55317 based on your feedback. In 
this feedback you said:

 5. I'm not a fan of the org.apache.tomcat.unittest package unless the classes 
 concerned are going to be used by multiple tests across multiple packages.

I put org.apache.tomcat.unittest.weaving.NeverUsedClass and 
org.apache.tomcat.unittest.weaving.UnweavedClass in this package because it 
seemed like a location that helper classes were being placed for other tests. 
However, I see your point about them only being used for one class. Should I 
just put these classes in org.apache.catalina.loader, the same package that 
TestWebappClassLoaderWeaving is in?

Thanks,

Nick

smime.p7s
Description: S/MIME cryptographic signature


[Bug 55554] New: NoSuchMethodError on ConcurrentHashMap$KeySetView

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=4

Bug ID: 4
   Summary: NoSuchMethodError on ConcurrentHashMap$KeySetView
   Product: Tomcat 8
   Version: trunk
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: rstoyanc...@yahoo.com

I'm getting the following stack trace with Java 7 (but no with Java 8):


java.lang.NoSuchMethodError:
java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
at
org.apache.catalina.core.ApplicationContext.getInitParameterNames(ApplicationContext.java:319)
at
org.apache.catalina.core.ApplicationContextFacade.getInitParameterNames(ApplicationContextFacade.java:368)
at
org.springframework.web.context.support.WebApplicationContextUtils.registerEnvironmentBeans(WebApplicationContextUtils.java:201)
at
org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.postProcessBeanFactory(AbstractRefreshableWebApplicationContext.java:175)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4830)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5276)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:698)
at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:968)
at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1742)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

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



[Bug 55554] NoSuchMethodError on ConcurrentHashMap$KeySetView

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=4

Mark Thomas ma...@apache.org changed:

   What|Removed |Added

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

--- Comment #1 from Mark Thomas ma...@apache.org ---
java.util.concurrent.ConcurrentHashMap$KeySetView doesn't exist in Java 7. I'm
not sure how but you appear to have a Java 8 artifact involved here. Whatever
is going on, it is an environmental issue on your system.

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



Re: Where to put a helper class for test?

2013-09-12 Thread Mark Thomas
On 12/09/2013 18:31, Nick Williams wrote:
 Mark,
 
 I'm working on revisions to my patch for BZ 55317 based on your
 feedback. In this feedback you said:
 
 5. I'm not a fan of the org.apache.tomcat.unittest package unless
 the classes concerned are going to be used by multiple tests across
 multiple packages.
 
 I put org.apache.tomcat.unittest.weaving.NeverUsedClass and
 org.apache.tomcat.unittest.weaving.UnweavedClass in this package
 because it seemed like a location that helper classes were being
 placed for other tests. However, I see your point about them only
 being used for one class. Should I just put these classes in
 org.apache.catalina.loader, the same package that
 TestWebappClassLoaderWeaving is in?

That is the normal convention. Convention is also that they start
Tester... so they are excluded from the unit test scan.

Mark

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



Re: Where to put a helper class for test?

2013-09-12 Thread Nick Williams

On Sep 12, 2013, at 1:03 PM, Mark Thomas wrote:

 On 12/09/2013 18:31, Nick Williams wrote:
 Mark,
 
 I'm working on revisions to my patch for BZ 55317 based on your
 feedback. In this feedback you said:
 
 5. I'm not a fan of the org.apache.tomcat.unittest package unless
 the classes concerned are going to be used by multiple tests across
 multiple packages.
 
 I put org.apache.tomcat.unittest.weaving.NeverUsedClass and
 org.apache.tomcat.unittest.weaving.UnweavedClass in this package
 because it seemed like a location that helper classes were being
 placed for other tests. However, I see your point about them only
 being used for one class. Should I just put these classes in
 org.apache.catalina.loader, the same package that
 TestWebappClassLoaderWeaving is in?
 
 That is the normal convention. Convention is also that they start
 Tester... so they are excluded from the unit test scan.
 
 Mark

Okay. So I should rename the classes:

org.apache.catalina.loader.TesterNeverUsedClass
org.apache.catalina.loader.TesterUnweavedClass

Did I understand that correctly?

Nick

smime.p7s
Description: S/MIME cryptographic signature


svn commit: r1522696 - /tomcat/trunk/java/org/apache/catalina/webresources/JarResource.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 19:01:27 2013
New Revision: 1522696

URL: http://svn.apache.org/r1522696
Log:
Fix indent

Modified:
tomcat/trunk/java/org/apache/catalina/webresources/JarResource.java

Modified: tomcat/trunk/java/org/apache/catalina/webresources/JarResource.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/JarResource.java?rev=1522696r1=1522695r2=1522696view=diff
==
--- tomcat/trunk/java/org/apache/catalina/webresources/JarResource.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/webresources/JarResource.java Thu Sep 
12 19:01:27 2013
@@ -61,7 +61,7 @@ public class JarResource extends Abstrac
 } else {
 name = resourceName.substring(index + 1);
 }
-}
+}
 }
 
 @Override



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



[Bug 55554] NoSuchMethodError on ConcurrentHashMap$KeySetView

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=4

rstoyanc...@yahoo.com changed:

   What|Removed |Added

 Resolution|INVALID |FIXED

--- Comment #2 from rstoyanc...@yahoo.com ---
Odd, because that is a JDK class and the issue occurs when I run with JDK 1.7.

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



[Bug 55317] Facilitate weaving by allowing ClassFileTransformer to be added to WebppClassLoader

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55317

Nick Williams nicho...@nicholaswilliams.net changed:

   What|Removed |Added

  Attachment #30749|0   |1
is obsolete||

--- Comment #17 from Nick Williams nicho...@nicholaswilliams.net ---
Created attachment 30825
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=30825action=edit
Proposed implementation of this feature

(In reply to Mark Thomas from comment #16)
 1. Why loop over list rather than using contains() in addTransformer() ?
  
 3. Why not use List.remove(Object) in removeTransformer() ?

That was my own mistake. I didn't read the Javadoc properly. I have corrected
this in the attached revised patch.

 4. I'm concerned that synchronizing on the list of transformers while classes 
 are transformed will become a bottleneck when lots of classes are being 
 loaded and the transformer is relatively slow. A separate ReadWriteLock for 
 the transformer list is probably the way to go but really some testing is 
 required to determine if there is an issue here or not.

Another mistake of mine. This could DEFINITELY be a problem if multiple threads
are loading classes at the same time. A ReadWriteLock is definitely preferable
over synchronization here. I have corrected this in the attached revised patch.

 5. I'm not a fan of the org.apache.tomcat.unittest package unless the classes 
 concerned are going to be used by multiple tests across multiple packages.

Understood. I have relocated/renamed these two classes in accordance with the
discussion on the mailing list. The changes are in the attached revised patch.

 2. Should addTransformer() be looking for multiple instances of the same 
 Transformer or multiple instances of the same class of Transformer?

No, this was correct. It could be valid to have multiple instances of the same
transformer class, but not multiple copies of the same instance.

An example use case is an application using JPA with Spring Framework. JPA
abstracts away from the java.lang.instrument.ClassFileTransformer by specifying
a javax.persistence.spi.ClassTransformer. JPA providers add ClassTransformers
to the persistence unit instead of ClassFileTransformers. Applying this
directly would require the ClassLoader to support
javax.persistence.spi.ClassTransformer, which won't work in many cases (such as
Tomcat). To get around this, Spring Framework uses a
org.springframework.orm.jpa.persistenceunit.ClassFileTransformerAdapter to wrap
a ClassTransformer with a ClassFileTransformer. If a provider adds multiple
ClassTransformer implementations to the persistence unit, Spring will in turn
add multiple ClassFileTransformerAdapter instances to the ClassLoader. All of
these instances will do something different, but they will be of the same class
as far as WebappClassLoader can tell.

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



Re: Where to put a helper class for test?

2013-09-12 Thread Christopher Schultz
Nick,

On 9/12/13 2:12 PM, Nick Williams wrote:
 
 On Sep 12, 2013, at 1:03 PM, Mark Thomas wrote:
 
 On 12/09/2013 18:31, Nick Williams wrote:
 Mark,

 I'm working on revisions to my patch for BZ 55317 based on your
 feedback. In this feedback you said:

 5. I'm not a fan of the org.apache.tomcat.unittest package unless
 the classes concerned are going to be used by multiple tests across
 multiple packages.

 I put org.apache.tomcat.unittest.weaving.NeverUsedClass and
 org.apache.tomcat.unittest.weaving.UnweavedClass in this package
 because it seemed like a location that helper classes were being
 placed for other tests. However, I see your point about them only
 being used for one class. Should I just put these classes in
 org.apache.catalina.loader, the same package that
 TestWebappClassLoaderWeaving is in?

 That is the normal convention. Convention is also that they start
 Tester... so they are excluded from the unit test scan.

 Mark
 
 Okay. So I should rename the classes:
 
 org.apache.catalina.loader.TesterNeverUsedClass
 org.apache.catalina.loader.TesterUnweavedClass
 
 Did I understand that correctly?

What about using static inner classes in your test case?

-chris



signature.asc
Description: OpenPGP digital signature


[Bug 55554] NoSuchMethodError on ConcurrentHashMap$KeySetView

2013-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=4

Christopher Schultz ch...@christopherschultz.net changed:

   What|Removed |Added

 Resolution|FIXED   |INVALID

--- Comment #3 from Christopher Schultz ch...@christopherschultz.net ---
Bug is INVALID, not FIXED.

When you run in Java 7 mode, something must be terribly wrong, because it looks
like it's trying to use a Java 8 class. That's what makes your environment
broken. Try re-installing the JRE?

-- 
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: r1522704 - in /tomcat/trunk/java/org/apache/catalina/loader: WebappClassLoader.java WebappLoader.java

2013-09-12 Thread markt
Author: markt
Date: Thu Sep 12 19:48:57 2013
New Revision: 1522704

URL: http://svn.apache.org/r1522704
Log:
More resources refactoring. Remove the need to extract the classes into the 
work dir.

Modified:
tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1522704r1=1522703r2=1522704view=diff
==
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Thu Sep 
12 19:48:57 2013
@@ -253,8 +253,9 @@ public class WebappClassLoader
 
 
 /**
- * Associated directory context giving access to the resources in this
- * webapp.
+ * Associated web resources for this webapp.
+ * TODO Review the use of resources in this class to see if further
+ *  simplifications can be made.
  */
 protected WebResourceRoot resources = null;
 
@@ -299,9 +300,10 @@ public class WebappClassLoader
 
 
 /**
- * The local repository for locally loaded classes or resources.
+ * The path to the repository for locally loaded classes or resources. This
+ * would normally be /WEB-INF/classes/.
  */
-protected String repository = null;
+protected String repositoryPath = null;
 
 
  /**
@@ -310,12 +312,11 @@ public class WebappClassLoader
  protected URL[] repositoryURLs = null;
 
 
-/**
- * Repository translated as path in the work directory (for Jasper
- * originally), but which is used to generate a fake URL should getURLs be
- * called.
- */
-protected File file = null;
+ /**
+  * The {@link WebResource} for the repository for locally loaded classes 
or
+  * resources. This would normally point to /WEB-INF/classes/.
+  */
+protected WebResource repository = null;
 
 
 /**
@@ -740,25 +741,22 @@ public class WebappClassLoader
 /**
  * Set the place this ClassLoader can look for classes to be loaded.
  *
- * @param repository Name of a source of classes to be loaded, such as a
+ * @param path  Path of a source of classes to be loaded, such as a
  *  directory pathname, a JAR file pathname, or a ZIP file pathname
  *
  * @exception IllegalArgumentException if the specified repository is
  *  invalid or does not exist
  */
-synchronized void setRepository(String repository, File file) {
-
-// Note : There should be only one (of course), but I think we should
-// keep this a bit generic
+synchronized void setRepository(String path, WebResource repository) {
 
-if (repository == null)
+if (path == null)
 return;
 
 if (log.isDebugEnabled())
-log.debug(addRepository( + repository + ));
+log.debug(addRepository( + path + ));
 
+this.repositoryPath = path;
 this.repository = repository;
-this.file = file;
 }
 
 
@@ -920,8 +918,8 @@ public class WebappClassLoader
 sb.append(  delegate: );
 sb.append(delegate);
 sb.append(\r\n);
-sb.append(  repository: );
-sb.append(repository);
+sb.append(  repositoryPath: );
+sb.append(repositoryPath);
 sb.append(\r\n);
 if (this.parent != null) {
 sb.append(-- Parent Classloader:\r\n);
@@ -1084,9 +1082,9 @@ public class WebappClassLoader
 
 int jarFilesLength = jarFiles.length;
 
-if (repository != null) {
+if (repositoryPath != null) {
 // Looking at the repository
-WebResource[] webResources = resources.getResources(repository + 
name);
+WebResource[] webResources = resources.getResources(repositoryPath 
+ name);
 for (WebResource webResource : webResources) {
 if (webResource.exists()) {
 result.add(webResource.getURL());
@@ -1512,7 +1510,7 @@ public class WebappClassLoader
 }
 
 int resultLength;
-if (file == null) {
+if (repository == null) {
 resultLength = jarRealFiles.length;
 } else {
 resultLength = jarRealFiles.length + 1;
@@ -1522,8 +1520,8 @@ public class WebappClassLoader
 
 try {
 URL[] urls = new URL[resultLength];
-if (file != null) {
-urls[off ++] = getURI(file);
+if (repository != null) {
+urls[off ++] = repository.getURL();
 }
 for (File jarRealFile : jarRealFiles) {
 urls[off++] = getURI(jarRealFile);
@@ -1641,8 +1639,6 @@ public class WebappClassLoader
 
 started = false;
 
-file = null;
-
 

Re: [Bug 55317] Facilitate weaving by allowing ClassFileTransformer to be added to WebppClassLoader

2013-09-12 Thread Nick Williams

On Aug 29, 2013, at 4:28 AM, bugzi...@apache.org wrote:

 https://issues.apache.org/bugzilla/show_bug.cgi?id=55317
 
 --- Comment #16 from Mark Thomas ma...@apache.org ---
 (In reply to Nick Williams from comment #15)
 Created attachment 30749 [details]
 Proposed implementation of this feature
 
 1. Why loop over list rather than using contains() in addTransformer() ?
 
 2. Should addTransformer() be looking for multiple instances of the same
 Transformer or multiple instances of the same class of Transformer?
 
 3. Why not use List.remove(Object) in removeTransformer() ?
 
 4. I'm concerned that synchronizing on the list of transformers while classes
 are transformed will become a bottleneck when lots of classes are being loaded
 and the transformer is relatively slow. A separate ReadWriteLock for the
 transformer list is probably the way to go but really some testing is required
 to determine if there is an issue here or not.
 
 5. I'm not a fan of the org.apache.tomcat.unittest package unless the classes
 concerned are going to be used by multiple tests across multiple packages.

FYI, I replied to your comments and submitted a revised patch. It doesn't 
appear that Bugzilla sent out an email this time. Not sure what happened, but I 
wanted to make sure you were notified somehow so that you could take a look.

Nick

smime.p7s
Description: S/MIME cryptographic signature