You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fs...@apache.org on 2015/01/22 21:54:47 UTC
svn commit: r1654064 - in /tomcat/tc7.0.x/trunk:
java/org/apache/naming/resources/DirContextURLConnection.java
webapps/docs/changelog.xml
Author: fschumacher
Date: Thu Jan 22 20:54:47 2015
New Revision: 1654064
URL: http://svn.apache.org/r1654064
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57420
Make UEncoder a local variable in DirContextURLConnection to make it threadsafe.
Based on ideas from kkolinko and violetagg.
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=1654064&r1=1654063&r2=1654064&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java Thu Jan 22 20:54:47 2015
@@ -42,6 +42,7 @@ import javax.naming.directory.DirContext
import org.apache.naming.JndiPermission;
import org.apache.tomcat.util.buf.UDecoder;
import org.apache.tomcat.util.buf.UEncoder;
+import org.apache.tomcat.util.buf.UEncoder.SafeCharsSet;
import org.apache.tomcat.util.http.FastHttpDateFormat;
/**
@@ -57,11 +58,6 @@ import org.apache.tomcat.util.http.FastH
public class DirContextURLConnection extends URLConnection {
private static final UDecoder URL_DECODER = new UDecoder();
- private static final UEncoder URL_ENCODER = new UEncoder();
-
- static{
- URL_ENCODER.addSafeCharacter('/');
- }
// ----------------------------------------------------------- Constructors
@@ -436,11 +432,12 @@ public class DirContextURLConnection ext
try {
NamingEnumeration<NameClassPair> enumeration =
collection.list("/");
+ UEncoder urlEncoder = new UEncoder(SafeCharsSet.WITH_SLASH);
while (enumeration.hasMoreElements()) {
NameClassPair ncp = enumeration.nextElement();
String s = ncp.getName();
result.addElement(
- URL_ENCODER.encodeURL(s, 0, s.length()).toString());
+ urlEncoder.encodeURL(s, 0, s.length()).toString());
}
} catch (NamingException e) {
// Unexpected exception
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=1654064&r1=1654063&r2=1654064&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Jan 22 20:54:47 2015
@@ -184,6 +184,11 @@
(markt)
</fix>
<fix>
+ <bug>57420</bug>: Make UEncoder a local variable in
+ DirContextURLConnection to make it threadsafe. Based on ideas from
+ kkolinko and violetagg. (fschumacher)
+ </fix>
+ <fix>
<bug>57425</bug>: Don't add attributes with null value or name to the
replicated context. (fschumacher)
</fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1654064 - in /tomcat/tc7.0.x/trunk: java/org/apache/naming/resources/DirContextURLConnection.java
webapps/docs/changelog.xml
Posted by Mark Thomas <ma...@apache.org>.
On 23/01/2015 08:51, Felix Schumacher wrote:
> diff --git a/res/checkstyle/org-import-control.xml
> b/res/checkstyle/org-import-control.xml
> index 8d79419..85191a8 100644
> --- a/res/checkstyle/org-import-control.xml
> +++ b/res/checkstyle/org-import-control.xml
> @@ -110,6 +110,7 @@
> <allow pkg="org.apache.naming"/>
> <allow class="org.apache.tomcat.util.buf.UDecoder"/>
> <allow class="org.apache.tomcat.util.buf.UEncoder"/>
> + <allow class="org.apache.tomcat.util.buf.UEncoder.SafeCharsSet"/>
> <allow class="org.apache.tomcat.util.http.FastHttpDateFormat"/>
> <allow class="org.apache.tomcat.util.http.RequestUtil"/>
> <subpackage name="factory.webservices">
>
> Would this be acceptable?
It would but I wonder why individual classes rather than packages are
being defined there. It is worth a look at the JAR packaging and
dependencies declared in the POMs to see of this could be simplified.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1654064 - in /tomcat/tc7.0.x/trunk:
java/org/apache/naming/resources/DirContextURLConnection.java webapps/docs/changelog.xml
Posted by Konstantin Kolinko <kn...@gmail.com>.
2015-01-23 11:51 GMT+03:00 Felix Schumacher <fe...@internetallee.de>:
> Am 23.01.2015 09:46, schrieb Violeta Georgieva:
>
>> Hi,
>>
>> 2015-01-23 8:12 GMT+02:00 Felix Schumacher <
>> felix.schumacher@internetallee.de>:
>>>
>>>
>>> Am 22.01.2015 um 21:54 schrieb fschumacher@apache.org:
>>>>
>>>>
>>>> Author: fschumacher
>>>> Date: Thu Jan 22 20:54:47 2015
>>>> New Revision: 1654064
>>>>
>>>> URL: http://svn.apache.org/r1654064
>>>> Log:
>>>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57420
>>>> Make UEncoder a local variable in DirContextURLConnection to make it
>>
>> threadsafe.
>>>>
>>>> Based on ideas from kkolinko and violetagg.
>>>>
>>>> Modified:
>>>>
>>
>>
>> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>>>>
>>>> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>>>>
>>>> Modified:
>>
>>
>> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>>>>
>>>> URL:
>>
>>
>> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=1654064&r1=1654063&r2=1654064&view=diff
>>>>
>>>>
>>
>> ==============================================================================
>>>>
>>>> ---
>>
>>
>> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>> (original)
>>>>
>>>> +++
>>
>>
>> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>> Thu Jan 22 20:54:47 2015
>>>>
>>>> @@ -42,6 +42,7 @@ import javax.naming.directory.DirContext
>>>> import org.apache.naming.JndiPermission;
>>>> import org.apache.tomcat.util.buf.UDecoder;
>>>> import org.apache.tomcat.util.buf.UEncoder;
>>>> +import org.apache.tomcat.util.buf.UEncoder.SafeCharsSet;
>>>
>>>
>>> After enabling the checkstyle validation (being reminded by gump), I now
>>
>> see, that this import is not allowed by checkstyle. But I don't know why
>> it
>> is illegal.
>>
>> I do not see such behavior on my side. Everything is OK with
>> DirContextURLConnection.
>
>
> I didn't see anything also, until I enabled checkstyle locally by adding
> "execute.validate=true" to my build.properties.
> I can make the failure go away by adding SafeCharSet to the allowed classes:
>
> diff --git a/res/checkstyle/org-import-control.xml
> b/res/checkstyle/org-import-control.xml
> index 8d79419..85191a8 100644
> --- a/res/checkstyle/org-import-control.xml
> +++ b/res/checkstyle/org-import-control.xml
> @@ -110,6 +110,7 @@
> <allow pkg="org.apache.naming"/>
> <allow class="org.apache.tomcat.util.buf.UDecoder"/>
> <allow class="org.apache.tomcat.util.buf.UEncoder"/>
> + <allow class="org.apache.tomcat.util.buf.UEncoder.SafeCharsSet"/>
> <allow class="org.apache.tomcat.util.http.FastHttpDateFormat"/>
> <allow class="org.apache.tomcat.util.http.RequestUtil"/>
> <subpackage name="factory.webservices">
>
> Would this be acceptable?
It is acceptable, as the purpose of that imports check is to disallow
unexpected dependencies between jars.
But personally I think it is more readable to just write the full form
"UEncoder.SafeCharsSet.WITH_SLASH" on that one line where that enum
is used.
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1654064 - in /tomcat/tc7.0.x/trunk:
java/org/apache/naming/resources/DirContextURLConnection.java webapps/docs/changelog.xml
Posted by Violeta Georgieva <mi...@gmail.com>.
2015-01-23 10:51 GMT+02:00 Felix Schumacher <
felix.schumacher@internetallee.de>:
>
> Am 23.01.2015 09:46, schrieb Violeta Georgieva:
>
>> Hi,
>>
>> 2015-01-23 8:12 GMT+02:00 Felix Schumacher <
>> felix.schumacher@internetallee.de>:
>>>
>>>
>>> Am 22.01.2015 um 21:54 schrieb fschumacher@apache.org:
>>>>
>>>>
>>>> Author: fschumacher
>>>> Date: Thu Jan 22 20:54:47 2015
>>>> New Revision: 1654064
>>>>
>>>> URL: http://svn.apache.org/r1654064
>>>> Log:
>>>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57420
>>>> Make UEncoder a local variable in DirContextURLConnection to make it
>>
>> threadsafe.
>>>>
>>>> Based on ideas from kkolinko and violetagg.
>>>>
>>>> Modified:
>>>>
>>
>>
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>>>>
>>>> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>>>>
>>>> Modified:
>>
>>
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>>>>
>>>> URL:
>>
>>
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=1654064&r1=1654063&r2=1654064&view=diff
>>>>
>>>>
>>
==============================================================================
>>>>
>>>> ---
>>
>>
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>> (original)
>>>>
>>>> +++
>>
>>
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>> Thu Jan 22 20:54:47 2015
>>>>
>>>> @@ -42,6 +42,7 @@ import javax.naming.directory.DirContext
>>>> import org.apache.naming.JndiPermission;
>>>> import org.apache.tomcat.util.buf.UDecoder;
>>>> import org.apache.tomcat.util.buf.UEncoder;
>>>> +import org.apache.tomcat.util.buf.UEncoder.SafeCharsSet;
>>>
>>>
>>> After enabling the checkstyle validation (being reminded by gump), I now
>>
>> see, that this import is not allowed by checkstyle. But I don't know why
it
>> is illegal.
>>
>> I do not see such behavior on my side. Everything is OK with
>> DirContextURLConnection.
>
>
> I didn't see anything also, until I enabled checkstyle locally by adding
"execute.validate=true" to my build.properties.
> I can make the failure go away by adding SafeCharSet to the allowed
classes:
Strange thing is that I do not see the problem in the Eclipse IDE but now
when I executed the check from the console the problem appeared.
> diff --git a/res/checkstyle/org-import-control.xml
b/res/checkstyle/org-import-control.xml
> index 8d79419..85191a8 100644
> --- a/res/checkstyle/org-import-control.xml
> +++ b/res/checkstyle/org-import-control.xml
> @@ -110,6 +110,7 @@
> <allow pkg="org.apache.naming"/>
> <allow class="org.apache.tomcat.util.buf.UDecoder"/>
> <allow class="org.apache.tomcat.util.buf.UEncoder"/>
> + <allow class="org.apache.tomcat.util.buf.UEncoder.SafeCharsSet"/>
> <allow class="org.apache.tomcat.util.http.FastHttpDateFormat"/>
> <allow class="org.apache.tomcat.util.http.RequestUtil"/>
> <subpackage name="factory.webservices">
>
> Would this be acceptable?
>
> Regards
> Felix
>
>
>>
>> Regards,
>> Violeta
>>
>>> Can anyone enlighten me on this?
>>>
>>> Thanks
>>> Felix
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
Re: svn commit: r1654064 - in /tomcat/tc7.0.x/trunk:
java/org/apache/naming/resources/DirContextURLConnection.java
webapps/docs/changelog.xml
Posted by Felix Schumacher <fe...@internetallee.de>.
Am 23.01.2015 09:46, schrieb Violeta Georgieva:
> Hi,
>
> 2015-01-23 8:12 GMT+02:00 Felix Schumacher <
> felix.schumacher@internetallee.de>:
>>
>> Am 22.01.2015 um 21:54 schrieb fschumacher@apache.org:
>>>
>>> Author: fschumacher
>>> Date: Thu Jan 22 20:54:47 2015
>>> New Revision: 1654064
>>>
>>> URL: http://svn.apache.org/r1654064
>>> Log:
>>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57420
>>> Make UEncoder a local variable in DirContextURLConnection to make it
> threadsafe.
>>> Based on ideas from kkolinko and violetagg.
>>>
>>> Modified:
>>>
>
> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>>> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>>>
>>> Modified:
> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>>> URL:
> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=1654064&r1=1654063&r2=1654064&view=diff
>>>
> ==============================================================================
>>> ---
> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
> (original)
>>> +++
> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
> Thu Jan 22 20:54:47 2015
>>> @@ -42,6 +42,7 @@ import javax.naming.directory.DirContext
>>> import org.apache.naming.JndiPermission;
>>> import org.apache.tomcat.util.buf.UDecoder;
>>> import org.apache.tomcat.util.buf.UEncoder;
>>> +import org.apache.tomcat.util.buf.UEncoder.SafeCharsSet;
>>
>> After enabling the checkstyle validation (being reminded by gump), I
>> now
> see, that this import is not allowed by checkstyle. But I don't know
> why it
> is illegal.
>
> I do not see such behavior on my side. Everything is OK with
> DirContextURLConnection.
I didn't see anything also, until I enabled checkstyle locally by adding
"execute.validate=true" to my build.properties.
I can make the failure go away by adding SafeCharSet to the allowed
classes:
diff --git a/res/checkstyle/org-import-control.xml
b/res/checkstyle/org-import-control.xml
index 8d79419..85191a8 100644
--- a/res/checkstyle/org-import-control.xml
+++ b/res/checkstyle/org-import-control.xml
@@ -110,6 +110,7 @@
<allow pkg="org.apache.naming"/>
<allow class="org.apache.tomcat.util.buf.UDecoder"/>
<allow class="org.apache.tomcat.util.buf.UEncoder"/>
+ <allow class="org.apache.tomcat.util.buf.UEncoder.SafeCharsSet"/>
<allow class="org.apache.tomcat.util.http.FastHttpDateFormat"/>
<allow class="org.apache.tomcat.util.http.RequestUtil"/>
<subpackage name="factory.webservices">
Would this be acceptable?
Regards
Felix
>
> Regards,
> Violeta
>
>> Can anyone enlighten me on this?
>>
>> Thanks
>> Felix
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1654064 - in /tomcat/tc7.0.x/trunk:
java/org/apache/naming/resources/DirContextURLConnection.java webapps/docs/changelog.xml
Posted by Violeta Georgieva <mi...@gmail.com>.
Hi,
2015-01-23 8:12 GMT+02:00 Felix Schumacher <
felix.schumacher@internetallee.de>:
>
> Am 22.01.2015 um 21:54 schrieb fschumacher@apache.org:
>>
>> Author: fschumacher
>> Date: Thu Jan 22 20:54:47 2015
>> New Revision: 1654064
>>
>> URL: http://svn.apache.org/r1654064
>> Log:
>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57420
>> Make UEncoder a local variable in DirContextURLConnection to make it
threadsafe.
>> Based on ideas from kkolinko and violetagg.
>>
>> Modified:
>>
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>>
>> Modified:
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
>> URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=1654064&r1=1654063&r2=1654064&view=diff
>>
==============================================================================
>> ---
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
(original)
>> +++
tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
Thu Jan 22 20:54:47 2015
>> @@ -42,6 +42,7 @@ import javax.naming.directory.DirContext
>> import org.apache.naming.JndiPermission;
>> import org.apache.tomcat.util.buf.UDecoder;
>> import org.apache.tomcat.util.buf.UEncoder;
>> +import org.apache.tomcat.util.buf.UEncoder.SafeCharsSet;
>
> After enabling the checkstyle validation (being reminded by gump), I now
see, that this import is not allowed by checkstyle. But I don't know why it
is illegal.
I do not see such behavior on my side. Everything is OK with
DirContextURLConnection.
Regards,
Violeta
> Can anyone enlighten me on this?
>
> Thanks
> Felix
>
Re: svn commit: r1654064 - in /tomcat/tc7.0.x/trunk: java/org/apache/naming/resources/DirContextURLConnection.java
webapps/docs/changelog.xml
Posted by Felix Schumacher <fe...@internetallee.de>.
Am 22.01.2015 um 21:54 schrieb fschumacher@apache.org:
> Author: fschumacher
> Date: Thu Jan 22 20:54:47 2015
> New Revision: 1654064
>
> URL: http://svn.apache.org/r1654064
> Log:
> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57420
> Make UEncoder a local variable in DirContextURLConnection to make it threadsafe.
> Based on ideas from kkolinko and violetagg.
>
> Modified:
> tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>
> Modified: tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java?rev=1654064&r1=1654063&r2=1654064&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java (original)
> +++ tomcat/tc7.0.x/trunk/java/org/apache/naming/resources/DirContextURLConnection.java Thu Jan 22 20:54:47 2015
> @@ -42,6 +42,7 @@ import javax.naming.directory.DirContext
> import org.apache.naming.JndiPermission;
> import org.apache.tomcat.util.buf.UDecoder;
> import org.apache.tomcat.util.buf.UEncoder;
> +import org.apache.tomcat.util.buf.UEncoder.SafeCharsSet;
After enabling the checkstyle validation (being reminded by gump), I now
see, that this import is not allowed by checkstyle. But I don't know why
it is illegal.
Can anyone enlighten me on this?
Thanks
Felix
> import org.apache.tomcat.util.http.FastHttpDateFormat;
>
> /**
> @@ -57,11 +58,6 @@ import org.apache.tomcat.util.http.FastH
> public class DirContextURLConnection extends URLConnection {
>
> private static final UDecoder URL_DECODER = new UDecoder();
> - private static final UEncoder URL_ENCODER = new UEncoder();
> -
> - static{
> - URL_ENCODER.addSafeCharacter('/');
> - }
>
> // ----------------------------------------------------------- Constructors
>
> @@ -436,11 +432,12 @@ public class DirContextURLConnection ext
> try {
> NamingEnumeration<NameClassPair> enumeration =
> collection.list("/");
> + UEncoder urlEncoder = new UEncoder(SafeCharsSet.WITH_SLASH);
> while (enumeration.hasMoreElements()) {
> NameClassPair ncp = enumeration.nextElement();
> String s = ncp.getName();
> result.addElement(
> - URL_ENCODER.encodeURL(s, 0, s.length()).toString());
> + urlEncoder.encodeURL(s, 0, s.length()).toString());
> }
> } catch (NamingException e) {
> // Unexpected exception
>
> 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=1654064&r1=1654063&r2=1654064&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Jan 22 20:54:47 2015
> @@ -184,6 +184,11 @@
> (markt)
> </fix>
> <fix>
> + <bug>57420</bug>: Make UEncoder a local variable in
> + DirContextURLConnection to make it threadsafe. Based on ideas from
> + kkolinko and violetagg. (fschumacher)
> + </fix>
> + <fix>
> <bug>57425</bug>: Don't add attributes with null value or name to the
> replicated context. (fschumacher)
> </fix>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org