On 01/09/2014 19:08, Felix Schumacher wrote:
> Am 01.09.2014 um 12:40 schrieb ma...@apache.org:
>> Author: markt
>> Date: Mon Sep  1 10:40:33 2014
>> New Revision: 1621731
>>
>> URL: http://svn.apache.org/r1621731
>> Log:
>> 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/trunk/java/org/apache/catalina/core/StandardContext.java
>>      tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
>>      tomcat/trunk/webapps/docs/changelog.xml
>>
>> 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=1621731&r1=1621730&r2=1621731&view=diff
>>
>> ==============================================================================
>>
>> --- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
>> (original)
>> +++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
>> Mon Sep  1 10:40:33 2014
>> @@ -918,7 +918,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/trunk/test/org/apache/catalina/core/TestStandardContext.java
>> URL:
>> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java?rev=1621731&r1=1621730&r2=1621731&view=diff
>>
>> ==============================================================================
>>
>> ---
>> tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
>> (original)
>> +++
>> tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
>> Mon Sep  1 10:40:33 2014
>> @@ -71,6 +71,7 @@ import org.apache.tomcat.util.descriptor
>>   import org.apache.tomcat.util.descriptor.web.FilterMap;
>>   import org.apache.tomcat.util.descriptor.web.LoginConfig;
>>   +
>>   public class TestStandardContext extends TomcatBaseTest {
>>         private static final String REQUEST =
>> @@ -945,4 +946,13 @@ public class TestStandardContext extends
>>             Assert.assertNull(realPath);
>>       }
>> +
>> +    @Test
>> +    public void testBug56903() {
>> +        Context context = new StandardContext();
>> +
>> +        String list = "a,b,c";
>> +        context.setResourceOnlyServlets(list);
>> +        Assert.assertEquals(list, context.getResourceOnlyServlets());
> Testcase: testBug56903 took 0,004 sec
>         FAILED
> expected:<[a,b,c]> but was:<[b,c,a]>
> junit.framework.AssertionFailedError: expected:<[a,b,c]> but was:<[b,c,a]>
>         at
> org.apache.catalina.core.TestStandardContext.testBug56903(TestStandardContext.java:956)
> 
> 
> The List ist constructed from a set, which is not sorted, so a simple
> List.equals seems to be not enough.
> 
> Sorry

No need to apologise. My mistake. The elements happened to be ordered
correctly on the machine I was working on so I thought I could get away
with a short cut. Obviously not. I'll use you original test.

Mark


>  Felix
>> +    }
>>   }
>>
>> Modified: tomcat/trunk/webapps/docs/changelog.xml
>> URL:
>> http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1621731&r1=1621730&r2=1621731&view=diff
>>
>> ==============================================================================
>>
>> --- tomcat/trunk/webapps/docs/changelog.xml (original)
>> +++ tomcat/trunk/webapps/docs/changelog.xml Mon Sep  1 10:40:33 2014
>> @@ -57,6 +57,12 @@
>>           reported by Coverity Scan. Based on a patch provided by Felix
>>           Schumacher. (markt)
>>         </fix>
>> +      <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>
>>       </changelog>
>>     </subsection>
>>   </section>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


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

Reply via email to