Author: violetagg
Date: Wed Sep  3 06:05:58 2014
New Revision: 1622166

URL: http://svn.apache.org/r1622166
Log:
Merged revision 1621731 from tomcat/trunk:
Correct the return value for StandardContext.getResourceOnlyServlets()
so that multiple names are separated by commas. Identified by Coverity
Scan and fixed based on a patch by Felix Schumacher.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1621731

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1622166&r1=1622165&r2=1622166&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Wed 
Sep  3 06:05:58 2014
@@ -984,7 +984,9 @@ public class StandardContext extends Con
         StringBuilder result = new StringBuilder();
         boolean first = true;
         for (String servletName : resourceOnlyServlets) {
-            if (!first) {
+            if (first) {
+                first = false;
+            } else {
                 result.append(',');
             }
             result.append(servletName);

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java?rev=1622166&r1=1622165&r2=1622166&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java 
(original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java 
Wed Sep  3 06:05:58 2014
@@ -68,6 +68,7 @@ import org.apache.catalina.startup.Tomca
 import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.util.buf.ByteChunk;
 
+
 public class TestStandardContext extends TomcatBaseTest {
 
     private static final String REQUEST =
@@ -859,4 +860,13 @@ public class TestStandardContext extends
         }
 
     }
+
+    @Test
+    public void testBug56903() {
+        Context context = new StandardContext();
+
+        String list = "a,b,c";
+        context.setResourceOnlyServlets(list);
+        Assert.assertEquals(list, context.getResourceOnlyServlets());
+    }
 }

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=1622166&r1=1622165&r2=1622166&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Sep  3 06:05:58 2014
@@ -103,6 +103,12 @@
         when Context have been reloaded. (kkolinko)
       </scode>
       <fix>
+        <bug>56903</bug>: Correct the return value for
+        <code>StandardContext.getResourceOnlyServlets()</code> so that multiple
+        names are separated by commas. Identified by Coverity Scan and fixed
+        based on a patch by Felix Schumacher. (markt)
+      </fix>
+      <fix>
         Fixed the multipart elements merge operation performed during web
         application deployment. Identified by Coverity Scan. (violetagg)
       </fix>



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

Reply via email to