This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
The following commit(s) were added to refs/heads/main by this push:
new 55fd002 Remove unused code
55fd002 is described below
commit 55fd00243524231e97252c18f9e5321f901ae2b8
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Sep 7 21:10:38 2026 +0100
Remove unused code
---
.../java/org/apache/tomcat/jakartaee/Util.java | 16 ---------
.../java/org/apache/tomcat/jakartaee/UtilTest.java | 40 ----------------------
2 files changed, 56 deletions(-)
diff --git a/src/main/java/org/apache/tomcat/jakartaee/Util.java
b/src/main/java/org/apache/tomcat/jakartaee/Util.java
index c5b3adb..73d8c65 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Util.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Util.java
@@ -16,11 +16,9 @@
*/
package org.apache.tomcat.jakartaee;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Locale;
@@ -68,20 +66,6 @@ public class Util {
os.flush();
}
- /**
- * Convert the input bytes as a string.
- * @param is the input byte stream
- * @param charset the charset to use
- * @return the converted string
- * @throws IOException if an exception occurs
- */
- public static String toString(InputStream is, Charset charset) throws
IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- Util.copy(is, baos);
-
- return new String(baos.toByteArray(), charset);
- }
-
private Util() {
// Hide default constructor. Utility class.
}
diff --git a/src/test/java/org/apache/tomcat/jakartaee/UtilTest.java
b/src/test/java/org/apache/tomcat/jakartaee/UtilTest.java
index 7b0a3f0..7ba15d8 100644
--- a/src/test/java/org/apache/tomcat/jakartaee/UtilTest.java
+++ b/src/test/java/org/apache/tomcat/jakartaee/UtilTest.java
@@ -114,44 +114,4 @@ public class UtilTest {
assertArrayEquals(source, out.toByteArray());
}
-
- @Test
- public void testToString() throws IOException {
- String original = "Hello, World!";
- ByteArrayInputStream in = new
ByteArrayInputStream(original.getBytes(StandardCharsets.ISO_8859_1));
-
- String result = Util.toString(in, StandardCharsets.ISO_8859_1);
-
- assertEquals(original, result);
- }
-
- @Test
- public void testToStringEmpty() throws IOException {
- ByteArrayInputStream in = new ByteArrayInputStream(new byte[0]);
-
- String result = Util.toString(in, StandardCharsets.ISO_8859_1);
-
- assertEquals("", result);
- }
-
- @Test
- public void testToStringUtf8() throws IOException {
- String original = "Hello, 世界!";
- ByteArrayInputStream in = new
ByteArrayInputStream(original.getBytes(StandardCharsets.UTF_8));
-
- String result = Util.toString(in, StandardCharsets.UTF_8);
-
- assertEquals(original, result);
- }
-
- @Test
- public void testToStringBinary() throws IOException {
- byte[] binary = new byte[]{0, 1, 2, 127, -128, -1};
- ByteArrayInputStream in = new ByteArrayInputStream(binary);
-
- String result = Util.toString(in, StandardCharsets.ISO_8859_1);
-
- assertNotNull(result);
- assertEquals(binary.length, result.length());
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]