hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r656904 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/TaskRunner.java
Date Fri, 16 May 2008 00:15:07 GMT
Author: cdouglas
Date: Thu May 15 17:15:07 2008
New Revision: 656904

URL: http://svn.apache.org/viewvc?rev=656904&view=rev
Log:
HADOOP-3377. Remove TaskRunner::replaceAll and replace with equivalent
String::replace. Contributed by Brice Arnould.


Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=656904&r1=656903&r2=656904&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu May 15 17:15:07 2008
@@ -143,6 +143,9 @@
     HADOOP-3013. Add corrupt block reporting to fsck.
     (lohit vijayarenu via cdouglas)
 
+    HADOOP-3377. Remove TaskRunner::replaceAll and replace with equivalent
+    String::replace. (Brice Arnould via cdouglas)
+
   OPTIMIZATIONS
 
     HADOOP-3274. The default constructor of BytesWritable creates empty 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java?rev=656904&r1=656903&r2=656904&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java Thu May 15 17:15:07
2008
@@ -294,7 +294,7 @@
       //  </property>
       //
       String javaOpts = conf.get("mapred.child.java.opts", "-Xmx200m");
-      javaOpts = replaceAll(javaOpts, "@taskid@", taskid.toString());
+      javaOpts = javaOpts.replace("@taskid@", taskid.toString());
       String [] javaOptsSplit = javaOpts.split(" ");
       
       // Add java.library.path; necessary for loading native libraries.
@@ -429,36 +429,6 @@
   }
 
   /**
-   * Replace <code>toFind</code> with <code>replacement</code>.
-   * When hadoop moves to JDK1.5, replace this method with
-   * String#replace (Of is commons-lang available, replace with
-   * StringUtils#replace). 
-   * @param text String to do replacements in.
-   * @param toFind String to find.
-   * @param replacement String to replace <code>toFind</code> with.
-   * @return A String with all instances of <code>toFind</code>
-   * replaced by <code>replacement</code> (The original
-   * <code>text</code> is returned if <code>toFind</code> is not
-   * found in <code>text<code>).
-   */
-  private static String replaceAll(String text, final String toFind,
-                                   final String replacement) {
-    if (text ==  null || toFind ==  null || replacement ==  null) {
-      throw new IllegalArgumentException("Text " + text + " or toFind " +
-                                         toFind + " or replacement " + replacement + " are
null.");
-    }
-    int offset = 0;
-    for (int index = text.indexOf(toFind); index >= 0;
-         index = text.indexOf(toFind, offset)) {
-      offset = index + toFind.length();
-      text = text.substring(0, index) + replacement +
-        text.substring(offset);
-        
-    }
-    return text;
-  }
-
-  /**
    * Run the child process
    */
   private void runChild(List<String> args, File dir,



Mime
View raw message