Revert "Disable caching for JarURLConnection to avoid sharing JarFile with other users when loading resource from URL in Configuration class. Contributed by Zhihai Xu"

This reverts commit e690a32e57.
This commit is contained in:
Zhihai Xu 2015-09-18 10:30:40 -07:00
parent 372ad270a0
commit 3732d5238a
2 changed files with 1 additions and 14 deletions

View File

@ -782,10 +782,6 @@ Release 2.8.0 - UNRELEASED
HADOOP-12413. AccessControlList should avoid calling getGroupNames in HADOOP-12413. AccessControlList should avoid calling getGroupNames in
isUserInList with empty groups. (Zhihai Xu via cnauroth) isUserInList with empty groups. (Zhihai Xu via cnauroth)
HADOOP-12404. Disable caching for JarURLConnection to avoid sharing
JarFile with other users when loading resource from URL in Configuration
class. (zxu)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-11785. Reduce the number of listStatus operation in distcp HADOOP-11785. Reduce the number of listStatus operation in distcp

View File

@ -34,9 +34,7 @@
import java.io.Writer; import java.io.Writer;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.JarURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -2533,14 +2531,7 @@ private Document parse(DocumentBuilder builder, URL url)
if (url == null) { if (url == null) {
return null; return null;
} }
return parse(builder, url.openStream(), url.toString());
URLConnection connection = url.openConnection();
if (connection instanceof JarURLConnection) {
// Disable caching for JarURLConnection to avoid sharing JarFile
// with other users.
connection.setUseCaches(false);
}
return parse(builder, connection.getInputStream(), url.toString());
} }
private Document parse(DocumentBuilder builder, InputStream is, private Document parse(DocumentBuilder builder, InputStream is,