svn commit: r1495327 - /tomcat/trunk/java/org/apache/catalina/core/ApplicationServletRegistration.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 08:34:25 2013
New Revision: 1495327

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

Modified:

tomcat/trunk/java/org/apache/catalina/core/ApplicationServletRegistration.java

Modified: 
tomcat/trunk/java/org/apache/catalina/core/ApplicationServletRegistration.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationServletRegistration.java?rev=1495327&r1=1495326&r2=1495327&view=diff
==
--- 
tomcat/trunk/java/org/apache/catalina/core/ApplicationServletRegistration.java 
(original)
+++ 
tomcat/trunk/java/org/apache/catalina/core/ApplicationServletRegistration.java 
Fri Jun 21 08:34:25 2013
@@ -55,7 +55,7 @@ public class ApplicationServletRegistrat
 @Override
 public String getClassName() {
 return wrapper.getServletClass();
-   }
+}
 
 @Override
 public String getInitParameter(String name) {



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



svn commit: r1495341 - /tomcat/trunk/java/org/apache/catalina/core/StandardContext.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 09:24:16 2013
New Revision: 1495341

URL: http://svn.apache.org/r1495341
Log:
Refactor and address some TODOs.
Should be no functional change.
Make code easier to follow and more obviously aligned to the specification.
Removing the to be overwritten patterns will result in all collections for the 
constraint being empty which will trigger the removal of the constraint (which 
is what the old code did more directly). The old code just looked as if it 
might be removing too much.

Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardContext.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1495341&r1=1495340&r2=1495341&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Fri Jun 21 
09:24:16 2013
@@ -5796,29 +5796,39 @@ public class StandardContext extends Con
 // Skip this pattern
 foundConflict = true;
 conflicts.add(urlPattern);
+break;
 } else {
 // Need to overwrite constraint for this pattern
-// so remove every pattern found
-
-// TODO spec 13.4.2 appears to say only the
-// conflicting pattern is overwritten, not the
-// entire security constraint.
-removeConstraint(securityConstraint);
+collection.removePattern(urlPattern);
+// If the collection is now empty, remove it
+if (collection.findPatterns().length == 0) {
+
securityConstraint.removeCollection(collection);
+}
 }
 }
-if (foundConflict) {
-break;
-}
 }
+
+// If the constraint now has no collections - remove it
+if (securityConstraint.findCollections().length == 0) {
+removeConstraint(securityConstraint);
+}
+
+// No need to check other constraints for the current pattern
+// once a conflict has been found
 if (foundConflict) {
 break;
 }
 }
-// TODO spec 13.4.2 appears to say that non-conflicting patterns 
are
-// still used.
-// TODO you can't calculate the eventual security constraint now,
-// you have to wait until the context is started, since application
-// code can add url patterns after calling setSecurity.
+
+// Note: For progammatically added Servlets this may not be the
+//   complete set of security constraints since additional
+//   URL patterns can be added after the application has called
+//   setSecurity. For all programmatically added servilets, the
+//   #dynamicServletAdded() method sets a flag that ensures 
that
+//   the constraints are re-evaluated before the servlet is
+//   first used
+
+// If the pattern did not conflict, add the new constraint(s).
 if (!foundConflict) {
 SecurityConstraint[] newSecurityConstraints =
 SecurityConstraint.createConstraints(
@@ -5832,7 +5842,6 @@ public class StandardContext extends Con
 }
 
 return conflicts;
-
 }
 
 



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



svn commit: r1495374 - /tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 10:33:52 2013
New Revision: 1495374

URL: http://svn.apache.org/r1495374
Log:
Add some more tests for denial of uncovered HTTP methods.
Remove some duplicate code.

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=1495374&r1=1495373&r2=1495374&view=diff
==
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java Fri Jun 
21 10:33:52 2013
@@ -20,12 +20,14 @@ package org.apache.catalina.core;
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.HashSet;
 import java.util.Set;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
 import javax.servlet.HttpConstraintElement;
+import javax.servlet.HttpMethodConstraintElement;
 import javax.servlet.MultipartConfigElement;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContainerInitializer;
@@ -63,6 +65,7 @@ import org.apache.catalina.deploy.LoginC
 import org.apache.catalina.loader.WebappLoader;
 import org.apache.catalina.startup.SimpleHttpClient;
 import org.apache.catalina.startup.TesterMapRealm;
+import org.apache.catalina.startup.TesterServlet;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.util.buf.ByteChunk;
@@ -453,7 +456,7 @@ public class TestStandardContext extends
 public void onStartup(Set> c, ServletContext ctx)
 throws ServletException {
 // Register and map servlet
-Servlet s = new Bug50015Servlet();
+Servlet s = new TesterServlet();
 ServletRegistration.Dynamic sr = ctx.addServlet("bug50015", s);
 sr.addMapping("/bug50015");
 
@@ -465,17 +468,84 @@ public class TestStandardContext extends
 }
 }
 
-public static final class Bug50015Servlet extends HttpServlet {
+@Test
+public void testDenyUncoveredHttpMethodsSCITrue() throws Exception {
+doTestDenyUncoveredHttpMethodsSCI(true);
+}
 
-private static final long serialVersionUID = 1L;
+@Test
+public void testDenyUncoveredHttpMethodsSCIFalse() throws Exception {
+doTestDenyUncoveredHttpMethodsSCI(false);
+}
 
-@Override
-protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-throws ServletException, IOException {
-resp.setContentType("text/plain");
-resp.getWriter().write("OK");
+private void doTestDenyUncoveredHttpMethodsSCI(boolean enableDeny)
+throws Exception {
+// Test that denying uncovered HTTP methods when adding servlet 
security
+// constraints programmatically does work.
+
+// Set up a container
+Tomcat tomcat = getTomcatInstance();
+
+// Must have a real docBase - just use temp
+File docBase = new File(System.getProperty("java.io.tmpdir"));
+Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
+ctx.setDenyUncoveredHttpMethods(enableDeny);
+
+// Setup realm
+TesterMapRealm realm = new TesterMapRealm();
+realm.addUser("tomcat", "tomcat");
+realm.addUserRole("tomcat", "tomcat");
+ctx.setRealm(realm);
+
+// Configure app for BASIC auth
+LoginConfig lc = new LoginConfig();
+lc.setAuthMethod("BASIC");
+ctx.setLoginConfig(lc);
+ctx.getPipeline().addValve(new BasicAuthenticator());
+
+// Add ServletContainerInitializer
+ServletContainerInitializer sci = new DenyUncoveredHttpMethodsSCI();
+ctx.addServletContainerInitializer(sci, null);
+
+// Start the context
+tomcat.start();
+
+// Request the first servlet
+ByteChunk bc = new ByteChunk();
+int rc = getUrl("http://localhost:"; + getPort() + "/test",
+bc, null);
+
+// Check for a 401
+if (enableDeny) {
+Assert.assertEquals("OK", bc.toString());
+Assert.assertEquals(403, rc);
+} else {
+Assert.assertEquals("OK", bc.toString());
+Assert.assertEquals(200, rc);
 }
+}
+
+public static final class DenyUncoveredHttpMethodsSCI
+implements ServletContainerInitializer {
 
+@Override
+public void onStartup(Set> c, ServletContext ctx)
+throws ServletException {
+// Register and map servlet
+Servlet s = new TesterServlet();
+ServletRegistration.Dynamic sr = ctx.addServlet("test", s);
+sr.addMapping("/test");
+
+// A

[Bug 55125] New: Tomcat does not shut down if LifecycleListener throws an exception

2013-06-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55125

Bug ID: 55125
   Summary: Tomcat does not shut down if LifecycleListener throws
an exception
   Product: Tomcat 7
   Version: 7.0.41
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: gnorming...@vmware.com

Created attachment 30467
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30467&action=edit
Logs

I needed to shut down Tomcat if an application fails to start. I was advised
that a LifecycleListener could shut down Tomcat by throwing an
IllegalStateException from its lifecycleEvent method. However, this produces
severe errors in the logs, but Tomcat does not shut down.

I saw this behaviour on Tomcat 7.0.41 and 7.0.40 using the test web application
from here:

https://github.com/cloudfoundry/java-test-applications

and v1.0.0 of the listener from here:

https://github.com/cloudfoundry/java-buildpack-support

(v1.1.0 of the listener was re-coded to halt the JVM).

I attach catalina.out.

Mark Thomas suggested I raise this bug, so he believes that Tomcat should shut
down.

-- 
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: r1495407 - /tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 12:23:43 2013
New Revision: 1495407

URL: http://svn.apache.org/r1495407
Log:
Read response bodies for error responses as well as non-error responses.

Modified:
tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java

Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?rev=1495407&r1=1495406&r2=1495407&view=diff
==
--- tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Fri Jun 
21 12:23:43 2013
@@ -373,23 +373,27 @@ public abstract class TomcatBaseTest ext
 Map> head = connection.getHeaderFields();
 resHead.putAll(head);
 }
-if (rc == HttpServletResponse.SC_OK) {
-InputStream is = connection.getInputStream();
-BufferedInputStream bis = null;
-try {
-bis = new BufferedInputStream(is);
-byte[] buf = new byte[2048];
-int rd = 0;
-while((rd = bis.read(buf)) > 0) {
-out.append(buf, 0, rd);
-}
-} finally {
-if (bis != null) {
-try {
-bis.close();
-} catch (IOException e) {
-// Ignore
-}
+InputStream is;
+if (rc < 400) {
+is = connection.getInputStream();
+} else {
+is = connection.getErrorStream();
+}
+
+BufferedInputStream bis = null;
+try {
+bis = new BufferedInputStream(is);
+byte[] buf = new byte[2048];
+int rd = 0;
+while((rd = bis.read(buf)) > 0) {
+out.append(buf, 0, rd);
+}
+} finally {
+if (bis != null) {
+try {
+bis.close();
+} catch (IOException e) {
+// Ignore
 }
 }
 }



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



svn commit: r1495414 - in /tomcat/trunk: java/org/apache/catalina/core/StandardContext.java test/org/apache/catalina/core/TestStandardWrapper.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 12:41:13 2013
New Revision: 1495414

URL: http://svn.apache.org/r1495414
Log:
Expand test cases for servlet security annotations to include deny uncovered 
http methods.
Fix the failure identified by violetagg

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

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1495414&r1=1495413&r2=1495414&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Fri Jun 21 
12:41:13 2013
@@ -5291,7 +5291,7 @@ public class StandardContext extends Con
 // Needs to be after SCIs and listeners as they may programatically
 // change constraints
 if (ok) {
-checkConstraintsForUncoveredMethods();
+checkConstraintsForUncoveredMethods(findConstraints());
 }
 
 try {
@@ -5358,9 +5358,10 @@ public class StandardContext extends Con
 }
 
 
-private void checkConstraintsForUncoveredMethods() {
+private void checkConstraintsForUncoveredMethods(
+SecurityConstraint[] constraints) {
 SecurityConstraint[] newConstraints =
-SecurityConstraint.findUncoveredHttpMethods(findConstraints(),
+SecurityConstraint.findUncoveredHttpMethods(constraints,
 getDenyUncoveredHttpMethods(), getLogger());
 for (SecurityConstraint constraint : newConstraints) {
 addConstraint(constraint);
@@ -5838,6 +5839,8 @@ public class StandardContext extends Con
 newSecurityConstraints) {
 addConstraint(securityConstraint);
 }
+
+checkConstraintsForUncoveredMethods(newSecurityConstraints);
 }
 }
 

Modified: tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java?rev=1495414&r1=1495413&r2=1495414&view=diff
==
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardWrapper.java Fri Jun 
21 12:41:13 2013
@@ -62,37 +62,89 @@ public class TestStandardWrapper extends
 
 @Test
 public void testSecurityAnnotationsSimple() throws Exception {
-doTest(DenyAllServlet.class.getName(), false, false, false);
+doTest(DenyAllServlet.class.getName(), false, false, false, false);
 }
 
 @Test
 public void testSecurityAnnotationsSubclass1() throws Exception {
-doTest(SubclassDenyAllServlet.class.getName(), false, false, false);
+doTest(SubclassDenyAllServlet.class.getName(),
+false, false, false,false);
 }
 
 @Test
 public void testSecurityAnnotationsSubclass2() throws Exception {
-doTest(SubclassAllowAllServlet.class.getName(), false, false, true);
+doTest(SubclassAllowAllServlet.class.getName(),
+false, false, true, false);
 }
 
 @Test
 public void testSecurityAnnotationsMethods1() throws Exception {
-doTest(MethodConstraintServlet.class.getName(), false, false, false);
+doTest(MethodConstraintServlet.class.getName(),
+false, false, false, false);
 }
 
 @Test
 public void testSecurityAnnotationsMethods2() throws Exception {
-doTest(MethodConstraintServlet.class.getName(), true, false, true);
+doTest(MethodConstraintServlet.class.getName(),
+true, false, true, false);
 }
 
 @Test
 public void testSecurityAnnotationsRole1() throws Exception {
-doTest(RoleAllowServlet.class.getName(), false, true, true);
+doTest(RoleAllowServlet.class.getName(), false, true, true, false);
 }
 
 @Test
 public void testSecurityAnnotationsRole2() throws Exception {
-doTest(RoleDenyServlet.class.getName(), false, true, false);
+doTest(RoleDenyServlet.class.getName(), false, true, false, false);
+}
+
+@Test
+public void testSecurityAnnotationsUncoveredGet01() throws Exception {
+// Use a POST with role - should be allowed
+doTest(UncoveredGetServlet.class.getName(), true, true, true, false);
+}
+
+@Test
+public void testSecurityAnnotationsUncoveredGet02() throws Exception {
+// Use a POST with role - should be allowed
+doTest(UncoveredGetServlet.class.getName(), true, true, true, true);
+}
+
+@Test
+public void testSecurityAnnotationsUncoveredGet03() thro

Re: svn commit: r1494915 - in /tomcat/trunk: java/org/apache/catalina/ java/org/apache/catalina/core/ java/org/apache/catalina/deploy/ java/org/apache/catalina/startup/ test/org/apache/catalina/core/

2013-06-21 Thread Mark Thomas
On 21/06/2013 07:39, Mark Thomas wrote:
> Violeta Georgieva  wrote:
> 
>> 2013/6/20 
>>> 
>>> Author: markt Date: Thu Jun 20 10:38:49 2013 New Revision:
>>> 1494915
>>> 
>>> URL: http://svn.apache.org/r1494915 Log: Servlet 3.1 Implement
>>> the new deny-uncovered-http-methods element in server.xml
> 
> That should have said web.xml
> 
>> That's for the xml but what about annotations?
> 
> Good catch. I think we probably do need to check those but I want to
> re-read the spec and the EG discussion to be sure.

The spec is poorly written (it says deny-uncovered-methods is processed
during deployment) but my understanding of the intention of this change
is that these should be checked.

>> We are processing them when loading the servlet. Shouldn't we add
>> check for uncovered methods to the 
>> o.a.catalina.core.StandardContext.addServletSecurity(...):
> 
> I don't have the code to hand right now so I'm not sure about that.
> It isn't where I immediately thought of but it might be a better
> place to do it.

I was thinking of the code in the Wrapper but this is a better place.
Should be fixed now.

Mark

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



[Bug 55126] New: IAE is thrown during deployment of ServerEndPoint having multiple text decoders

2013-06-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55126

Bug ID: 55126
   Summary: IAE is thrown during deployment of ServerEndPoint
having multiple text decoders
   Product: Tomcat 8
   Version: trunk
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: nick...@gmail.com

Created attachment 30468
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30468&action=edit
Patch in PojoMethodMapping MessageMethod

PojoMethodMappin.MessageMethod can throw IAE when there are multiple text
decoders. The looping through the text decoders should be breaked. Here I
attach the patch.

-- 
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 55126] IAE is thrown during deployment of ServerEndPoint having multiple text decoders

2013-06-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55126

Niki Dokovski  changed:

   What|Removed |Added

  Attachment #30468|0   |1
   is patch||

-- 
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: r1495445 - in /tomcat/trunk/java/org/apache/tomcat/websocket: LocalStrings.properties WsSession.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 14:05:40 2013
New Revision: 1495445

URL: http://svn.apache.org/r1495445
Log:
WebSocket 1.0. Section 2.1.5. Session expiry must be signalled to the local 
endpoint with a close code of 1006.

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1495445&r1=1495444&r2=1495445&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Fri 
Jun 21 14:05:40 2013
@@ -57,7 +57,6 @@ wsSession.closed=The WebSocket session h
 wsSession.duplicateHandlerBinary=A binary message handler has already been 
configured
 wsSession.duplicateHandlerPong=A pong message handler has already been 
configured
 wsSession.duplicateHandlerText=A text message handler has already been 
configured
-wsSession.expireFailed=Unable to close expired session cleanly
 wsSession.sendCloseFail=Failed to send close message to remote endpoint
 wsSession.invalidHandlerTypePong=A pong message handler must implement 
MessageHandler.Basic
 wsSession.removeHandlerFailed=Unable to remove the handler [{0}] as it was not 
registered with this session

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1495445&r1=1495444&r2=1495445&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java Fri Jun 21 
14:05:40 2013
@@ -356,6 +356,38 @@ public class WsSession implements Sessio
 
 
 /**
+ * WebSocket 1.0. Section 2.1.5.
+ * Need internal close method as spec requires that the local endpoint
+ * receives a 1006 on timeout.
+ */
+private void closeTimeout(CloseReason closeReason) {
+// Double-checked locking. OK because state is volatile
+if (state != State.OPEN) {
+return;
+}
+
+synchronized (stateLock) {
+if (state != State.OPEN) {
+return;
+}
+
+// This state exists to protect against recursive calls to close()
+// from Endpoint.onClose()
+state = State.PRE_CLOSING;
+
+CloseReason localCloseReason =
+new CloseReason(CloseCodes.CLOSED_ABNORMALLY,
+closeReason.getReasonPhrase());
+fireEndpointOnClose(localCloseReason);
+
+state = State.CLOSING;
+
+sendCloseMessage(closeReason);
+}
+}
+
+
+/**
  * Called when a close message is received. Should only ever happen once.
  * Also called after a protocol error when the ProtocolHandler needs to
  * force the closing of the connection.
@@ -501,12 +533,8 @@ public class WsSession implements Sessio
 }
 
 if (System.currentTimeMillis() - lastActive > timeout) {
-try {
-close(new CloseReason(CloseCodes.GOING_AWAY,
-sm.getString("wsSession.timeout")));
-} catch (IOException e) {
-log.warn(sm.getString("wsSession.expireFailed"), e);
-}
+closeTimeout(new CloseReason(CloseCodes.GOING_AWAY,
+sm.getString("wsSession.timeout")));
 }
 }
 



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



[taglibs] Building Standard

2013-06-21 Thread Henri Yandell
Coming back to this after a while :)

Does anyone else get errors when trying to build standard regarding
LocaleUtils?


/Users/hen/Keep/OSS/apache/tomcat-taglibs/standard/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java:[25,49]
cannot find symbol
symbol  : class LocaleUtil
location: package org.apache.taglibs.standard.tag.common.fmt

/Users/hen/Keep/OSS/apache/tomcat-taglibs/standard/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java:[25,49]
cannot find symbol
symbol  : class LocaleUtil
location: package org.apache.taglibs.standard.tag.common.fmt

/Users/hen/Keep/OSS/apache/tomcat-taglibs/standard/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java:[194,28]
cannot find symbol
symbol  : variable LocaleUtil
location: class org.apache.taglibs.standard.tag.el.fmt.ParseDateTag

/Users/hen/Keep/OSS/apache/tomcat-taglibs/standard/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java:[164,28]
cannot find symbol
symbol  : variable LocaleUtil
location: class org.apache.taglibs.standard.tag.el.fmt.ParseNumberTag

?


buildbot failure in ASF Buildbot on tomcat-trunk

2013-06-21 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/4504

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

Buildslave for this Build: bb-vm_ubuntu

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

BUILD FAILED: failed compile_1

sincerely,
 -The Buildbot





[jira] [Commented] (MTOMCAT-216) tomca7:run fails in multi-module project with overlays

2013-06-21 Thread Petar Tahchiev (JIRA)

[ 
https://issues.apache.org/jira/browse/MTOMCAT-216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13690417#comment-13690417
 ] 

Petar Tahchiev commented on MTOMCAT-216:


Actually I had the same problem,
before I add different context path declarations



to my webapps definition.

> tomca7:run fails in multi-module project with overlays
> --
>
> Key: MTOMCAT-216
> URL: https://issues.apache.org/jira/browse/MTOMCAT-216
> Project: Apache Tomcat Maven Plugin
>  Issue Type: Bug
>  Components: tomcat7
>Affects Versions: 2.1
> Environment: Windows 7 64-bit, Java 7u17 64-bit, maven 3.0.4, 
> tomcat7-maven-plugin 2.1
>Reporter: Jan Zelenka
>Assignee: Olivier Lamy (*$^¨%`£)
> Attachments: overlay.zip, repro.zip
>
>
> I have maven multi module project with two war child projects:
> parent pom.xml
> --- mainWebapp
> --- overlayWebapp
> mainWebapp has dependency of type war on overlayWebapp
> overlayWebapp has only static resources (css, js..)
> mvn package (run from parent project) works correctly, mainWebapp.war 
> contains overlaid resources from overlayWebapp
> mvn tomcat7:run (run from root parent project) fails with exception:
> [INFO] create webapp with contextPath: /mainWebapp
> [ERROR] fail to extract war file 
> C:\projekty\FIS\source\overlayWebapp\target\classes, reason:The source file 
> C:\projekty\FIS\source\overlayWebapp\target\classes doesn't exist.
> org.codehaus.plexus.archiver.ArchiverException: The source file 
> C:\projekty\FIS\source\overlayWebapp\target\classes doesn't exist.
> at 
> org.codehaus.plexus.archiver.AbstractUnArchiver.validate(AbstractUnArchiver.java:190)
> at 
> org.codehaus.plexus.archiver.AbstractUnArchiver.extract(AbstractUnArchiver.java:118)
> at 
> org.apache.tomcat.maven.common.run.DefaultClassLoaderEntriesCalculator.calculateClassPathEntries(DefaultClassLoaderEntriesCalculator.java:152)
> at 
> org.apache.tomcat.maven.plugin.tomcat7.run.RunMojo.createWebappLoader(RunMojo.java:239)
> at 
> org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.createContext(AbstractRunMojo.java:612)
> at 
> org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:999)
> at 
> org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:512)
> at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
> at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
> at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
> at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> when I create some classpath resource in overlayWebapp to create 
> overlayWebapp\target\classes directory, there is an different exception:
> [INFO] create webapp with contextPath: /mainWebapp
> [ERROR] fail to extract war file 
> C:\projekty\FIS\source\overlayWebapp\target\classes, reason:The source must 
> not be a directory.
> org.codehaus.plexus.archiver.ArchiverException: The source must not be a 
> directory.
> at 
> org.codehaus.plexus.archiver.AbstractUnArchiver.v

svn commit: r1495541 - /tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 18:58:40 2013
New Revision: 1495541

URL: http://svn.apache.org/r1495541
Log:
Fix broken test

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=1495541&r1=1495540&r2=1495541&view=diff
==
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java Fri Jun 
21 18:58:40 2013
@@ -517,7 +517,8 @@ public class TestStandardContext extends
 
 // Check for a 401
 if (enableDeny) {
-Assert.assertEquals("OK", bc.toString());
+// Should be default error page
+Assert.assertTrue(bc.toString().contains("403"));
 Assert.assertEquals(403, rc);
 } else {
 Assert.assertEquals("OK", bc.toString());



-
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-06-21 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/4505

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

Buildslave for this Build: bb-vm_ubuntu

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

Build succeeded!

sincerely,
 -The Buildbot





svn commit: r1495587 - /tomcat/trunk/webapps/docs/jndi-resources-howto.xml

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 20:29:49 2013
New Revision: 1495587

URL: http://svn.apache.org/r1495587
Log:
Trailing whitespace

Modified:
tomcat/trunk/webapps/docs/jndi-resources-howto.xml

Modified: tomcat/trunk/webapps/docs/jndi-resources-howto.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/jndi-resources-howto.xml?rev=1495587&r1=1495586&r2=1495587&view=diff
==
--- tomcat/trunk/webapps/docs/jndi-resources-howto.xml (original)
+++ tomcat/trunk/webapps/docs/jndi-resources-howto.xml Fri Jun 21 20:29:49 2013
@@ -511,7 +511,7 @@ Transport.send(message);
 properties defined in Annex A of the JavaMail specification, individual
 providers may also support additional properties.
 
-
+
 If the resource is configured with a password attribute and
 either a mail.smtp.user or mail.user attribute
 then Tomcat's resource factory will configure and add a



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



svn commit: r1495588 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 20:35:58 2013
New Revision: 1495588

URL: http://svn.apache.org/r1495588
Log:
WebSocket 1.0. Section 2.1.5.
The close message needs to be sent before Endpoint.onClose() is called.

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1495588&r1=1495587&r2=1495588&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java Fri Jun 21 
20:35:58 2013
@@ -257,7 +257,7 @@ public class WsSession implements Sessio
 
 @Override
 public boolean isOpen() {
-return state == State.OPEN || state == State.PRE_CLOSING;
+return state == State.OPEN;
 }
 
 
@@ -342,15 +342,11 @@ public class WsSession implements Sessio
 return;
 }
 
-// This state exists to protect against recursive calls to close()
-// from Endpoint.onClose()
-state = State.PRE_CLOSING;
-
-fireEndpointOnClose(closeReason);
-
 state = State.CLOSING;
 
 sendCloseMessage(closeReason);
+
+fireEndpointOnClose(closeReason);
 }
 }
 
@@ -371,18 +367,15 @@ public class WsSession implements Sessio
 return;
 }
 
-// This state exists to protect against recursive calls to close()
-// from Endpoint.onClose()
-state = State.PRE_CLOSING;
+state = State.CLOSING;
+
+sendCloseMessage(closeReason);
 
 CloseReason localCloseReason =
 new CloseReason(CloseCodes.CLOSED_ABNORMALLY,
 closeReason.getReasonPhrase());
-fireEndpointOnClose(localCloseReason);
 
-state = State.CLOSING;
-
-sendCloseMessage(closeReason);
+fireEndpointOnClose(localCloseReason);
 }
 }
 
@@ -394,20 +387,14 @@ public class WsSession implements Sessio
  */
 public void onClose(CloseReason closeReason) {
 
-boolean sendCloseMessage = false;
-
 synchronized (stateLock) {
 if (state == State.OPEN) {
-sendCloseMessage = true;
+sendCloseMessage(closeReason);
 fireEndpointOnClose(closeReason);
 }
 
 state = State.CLOSED;
 
-if (sendCloseMessage) {
-sendCloseMessage(closeReason);
-}
-
 // Close the socket
 wsRemoteEndpoint.close();
 }
@@ -547,7 +534,6 @@ public class WsSession implements Sessio
 
 private static enum State {
 OPEN,
-PRE_CLOSING,
 CLOSING,
 CLOSED
 }



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



svn commit: r1495600 - /tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

2013-06-21 Thread markt
Author: markt
Date: Fri Jun 21 21:07:06 2013
New Revision: 1495600

URL: http://svn.apache.org/r1495600
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55126
For methods annotated with @onMessage
It is OK for multiple decoders to match a single message parameter
It is not OK for multiple parameters within a method to be possible message 
parameters.

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java?rev=1495600&r1=1495599&r2=1495600&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/pojo/PojoMethodMapping.java 
Fri Jun 21 21:07:06 2013
@@ -367,6 +367,8 @@ public class PojoMethodMapping {
 m.getName(), m.getDeclaringClass().getName()));
 }
 } else {
+boolean foundBinaryDecoderMatch = false;
+boolean foundTextDecoderMatch = false;
 for (DecoderEntry decoderEntry : decoderEntries) {
 if (decoderEntry.getClazz().isAssignableFrom(
 types[i])) {
@@ -374,21 +376,26 @@ public class PojoMethodMapping {
 decoderEntry.getDecoder().getClass()) 
||
 BinaryStream.class.isAssignableFrom(
 
decoderEntry.getDecoder().getClass())) {
-if (indexByteBuffer == -1) {
-indexByteBuffer = i;
-} else {
-throw new 
IllegalArgumentException(sm.getString(
-
"pojoMethodMapping.duplicateMessageParam",
-m.getName(), 
m.getDeclaringClass().getName()));
+if (!foundBinaryDecoderMatch) {
+if (indexByteBuffer == -1) {
+indexByteBuffer = i;
+foundBinaryDecoderMatch = true;
+} else {
+throw new 
IllegalArgumentException(sm.getString(
+
"pojoMethodMapping.duplicateMessageParam",
+m.getName(), 
m.getDeclaringClass().getName()));
+}
 }
-break;
 } else {
-if (indexString == -1) {
-indexString = i;
-} else {
-throw new 
IllegalArgumentException(sm.getString(
-
"pojoMethodMapping.duplicateMessageParam",
-m.getName(), 
m.getDeclaringClass().getName()));
+if (!foundTextDecoderMatch) {
+if (indexString == -1) {
+indexString = i;
+foundTextDecoderMatch = true;
+} else {
+throw new 
IllegalArgumentException(sm.getString(
+
"pojoMethodMapping.duplicateMessageParam",
+m.getName(), 
m.getDeclaringClass().getName()));
+}
 }
 }
 }



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



[Bug 55126] IAE is thrown during deployment of ServerEndPoint having multiple text decoders

2013-06-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55126

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
 OS||All

--- Comment #1 from Mark Thomas  ---
Thanks for the report. The code is wrong but not in the way this report
suggests. I have fixed the mapping code to permit multiple decoders to match to
a single parameter while not allowing the possibility of multiple message
parameters within a single method.

-- 
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 55122] GlobalRequestProcessor "bytesReceived" statistic always is zero

2013-06-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55122

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID
 OS||All

--- Comment #1 from Mark Thomas  ---
bytesSent and bytesReceived count request and response bodies but not headers.
Try a POST (e.g. http://localhost:8080/examples/servlets/servlet/CookieExample)

-- 
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 failure in ASF Buildbot on tomcat-trunk

2013-06-21 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/4507

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

Buildslave for this Build: bb-vm_ubuntu

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

BUILD FAILED: failed compile_1

sincerely,
 -The Buildbot





Re: [taglibs] Building Standard

2013-06-21 Thread Henri Yandell
Figured out. I was using mvn package rather than mvn install.

Too used to simple dependency structures over in Commons.

Hen

On Fri, Jun 21, 2013 at 7:51 AM, Henri Yandell  wrote:

>
> Coming back to this after a while :)
>
> Does anyone else get errors when trying to build standard regarding
> LocaleUtils?
>
>
> /Users/hen/Keep/OSS/apache/tomcat-taglibs/standard/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java:[25,49]
> cannot find symbol
> symbol  : class LocaleUtil
> location: package org.apache.taglibs.standard.tag.common.fmt
>
> /Users/hen/Keep/OSS/apache/tomcat-taglibs/standard/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java:[25,49]
> cannot find symbol
> symbol  : class LocaleUtil
> location: package org.apache.taglibs.standard.tag.common.fmt
>
> /Users/hen/Keep/OSS/apache/tomcat-taglibs/standard/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java:[194,28]
> cannot find symbol
> symbol  : variable LocaleUtil
> location: class org.apache.taglibs.standard.tag.el.fmt.ParseDateTag
>
> /Users/hen/Keep/OSS/apache/tomcat-taglibs/standard/jstlel/src/main/java/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java:[164,28]
> cannot find symbol
> symbol  : variable LocaleUtil
> location: class org.apache.taglibs.standard.tag.el.fmt.ParseNumberTag
>
> ?
>


[Bug 55127] New: Encoders init and destroy methods are never called

2013-06-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55127

Bug ID: 55127
   Summary: Encoders init and destroy methods are never called
   Product: Tomcat 8
   Version: trunk
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: nick...@gmail.com

Created attachment 30470
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30470&action=edit
encoders lifecycle patch

Non of the lifecycle methods (init and destroy) related to the encoders are get
called. Here is a patch with extended test case (TestEncodingDecoding). The
provides the implementation. (It is a proposal impl.) I think we need CLOSING
state checked in WsSession as the decoders destroy are called during that phase
and current implementation of checkState() method does not consider this state.
Mark, this time I used the checkstyle.xml found in res folder and hope that at
least the sources are in proper shape from syntax point of view.

cheers

-- 
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 55127] Encoders init and destroy methods are never called

2013-06-21 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55127

Niki Dokovski  changed:

   What|Removed |Added

  Attachment #30470|0   |1
   is patch||

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