瀏覽代碼

commit 6650ead8bd3b08ab1ce0046203733cda5104a69b
Author: Owen O'Malley <omalley@apache.org>
Date: Mon Sep 20 00:23:55 2010 -0700

fix array out of bounds exception by ignoring non-archives when updating
the sizes


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077708 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 年之前
父節點
當前提交
e9e09569a6

+ 2 - 23
src/mapred/org/apache/hadoop/filecache/TaskDistributedCacheManager.java

@@ -246,28 +246,6 @@ public class TaskDistributedCacheManager {
     return classPaths;
   }
   
-  private List<String> formClasspath(Path[] paths, URI[] uris, 
-                                     Path[] localizedFiles) {
-    if (uris == null) {
-      return new ArrayList<String>();
-    }
-    Map<String, Path> clMap = new HashMap<String, Path>();
-    List<String> classPaths = new ArrayList<String>();
-    if (paths != null) {
-      for (Path p : paths) {
-        clMap.put(p.toUri().getPath().toString(), p);
-      }
-    }
-    for (int i = 0; i < uris.length; ++i) {
-      URI u = uris[i];
-      boolean isClassPath = (null != clMap.get(u.getPath()));
-      if (isClassPath) {
-        classPaths.add(localizedFiles[i].toString());
-      }
-    }
-    return classPaths;
-  }
-
   /**
    * Releases the cached files/archives, so that space
    * can be reclaimed by the {@link TrackerDistributedCacheManager}.
@@ -283,7 +261,8 @@ public class TaskDistributedCacheManager {
   public void setSizes(long[] sizes) throws IOException {
     int i = 0;
     for (CacheFile c: cacheFiles) {
-      if (!c.isPublic && c.status != null) {
+      if (!c.isPublic && c.type == CacheFile.FileType.ARCHIVE && 
+    	  c.status != null) {
         distributedCacheManager.setSize(c.status, sizes[i++]);
       }
     }

+ 0 - 2
src/mapred/org/apache/hadoop/filecache/TrackerDistributedCacheManager.java

@@ -175,7 +175,6 @@ public class TrackerDistributedCacheManager {
       }
     }
     
-    boolean initSuccessful = false;
     try {
       // do the localization, after releasing the global lock
       synchronized (lcacheStatus) {
@@ -216,7 +215,6 @@ public class TrackerDistributedCacheManager {
         // try some cache deletions
         compactCache(conf);
       }
-      initSuccessful = true;
     } catch (IOException ie) {
       synchronized (lcacheStatus) {
         // release this cache