This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 65cbce6  Use String.replace() instead of replaceAll() when we don't 
need a Regex.
65cbce6 is described below

commit 65cbce6c54e11d7633483093e6b7e4d6c92dde64
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Feb 28 18:38:48 2021 -0500

    Use String.replace() instead of replaceAll() when we don't need a Regex.
---
 src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java | 2 +-
 .../java/org/apache/commons/compress/archivers/zip/ZipFileTest.java   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
index c62b2a6..8ffc79d 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
@@ -256,7 +256,7 @@ public class TarUtils {
         // can throw an IOException which parseOctal* doesn't declare
         String string = new String(buffer, offset, length);
 
-        string=string.replaceAll("\0", "{NUL}"); // Replace NULs to allow 
string to be printed
+        string=string.replace("\0", "{NUL}"); // Replace NULs to allow string 
to be printed
         return "Invalid byte "+currentByte+" at offset "+(current-offset)+" in 
'"+string+"' len="+length;
     }
 
diff --git 
a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java 
b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
index bab4b81..d2bbe89 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
@@ -984,8 +984,8 @@ public class ZipFileTest {
         String tempLineInFile1;
         String tempLineInFile2;
         for(int i = 0;i < linesOfFile1.size();i++) {
-            tempLineInFile1 = linesOfFile1.get(i).replaceAll("\r\n", "\n");
-            tempLineInFile2 = linesOfFile2.get(i).replaceAll("\r\n", "\n");
+            tempLineInFile1 = linesOfFile1.get(i).replace("\r\n", "\n");
+            tempLineInFile2 = linesOfFile2.get(i).replace("\r\n", "\n");
             Assert.assertEquals(tempLineInFile1, tempLineInFile2);
         }
     }

Reply via email to