From 3732d5238a9aa81514e27c7f0feabc454b57134b Mon Sep 17 00:00:00 2001 From: Zhihai Xu Date: Fri, 18 Sep 2015 10:30:40 -0700 Subject: [PATCH] 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 e690a32e57bc14b0cca0e2d39da513841d81b4fc. --- hadoop-common-project/hadoop-common/CHANGES.txt | 4 ---- .../java/org/apache/hadoop/conf/Configuration.java | 11 +---------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 2bf5c9dc135..54d7b6b7754 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -782,10 +782,6 @@ Release 2.8.0 - UNRELEASED HADOOP-12413. AccessControlList should avoid calling getGroupNames in 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 HADOOP-11785. Reduce the number of listStatus operation in distcp diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java index 8801c6cf8ec..0b4542966c4 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java @@ -34,9 +34,7 @@ import java.io.Reader; import java.io.Writer; import java.lang.ref.WeakReference; import java.net.InetSocketAddress; -import java.net.JarURLConnection; import java.net.URL; -import java.net.URLConnection; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -2533,14 +2531,7 @@ public class Configuration implements Iterable>, if (url == null) { return null; } - - 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()); + return parse(builder, url.openStream(), url.toString()); } private Document parse(DocumentBuilder builder, InputStream is,