This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch update_7.0.X
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git
The following commit(s) were added to refs/heads/update_7.0.X by this push:
new d6d21462 update 7.0.X
d6d21462 is described below
commit d6d214627e8555edbadccf919d50e6eb5d8da6bf
Author: Lee Rhodes <[email protected]>
AuthorDate: Fri May 8 16:11:00 2026 -0700
update 7.0.X
---
.../apache/datasketches/memory/internal/Util.java | 29 +---------------------
1 file changed, 1 insertion(+), 28 deletions(-)
diff --git
a/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Util.java
b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Util.java
index 59cb8bbf..11d2e61a 100644
---
a/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Util.java
+++
b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Util.java
@@ -30,7 +30,6 @@ import java.net.URL;
import java.nio.ByteOrder;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Objects;
import java.util.Random;
@@ -294,32 +293,6 @@ public final class Util {
}
}
- /**
- * Gets the Path of the given resource file's shortName.
- *
- * <p>Note that the ClassLoader.getResource(shortName) returns a URL,
- * which can have special characters, e.g., "%20" for spaces. This method
- * obtains the URL, converts it to a URI, then does a uri.getPath(), which
- * decodes any special characters in the URI path. This is required to make
- * obtaining resources operating-system independent.</p>
- *
- * @param shortFileName the last name in the pathname's name sequence.
- * @return the absolute path of the given resource file's shortName.
- */
- public static String getResourcePath(final String shortFileName) {
- Objects.requireNonNull(shortFileName, "input parameter " + shortFileName +
" cannot be null.");
- try {
- final URL url = Util.class.getClassLoader().getResource(shortFileName);
- Objects.requireNonNull(url, "resource " + shortFileName + " could not be
acquired.");
- final URI uri = url.toURI();
- //decodes any special characters
- final String pathStr = uri.isAbsolute() ?
Paths.get(uri).toAbsolutePath().toString() : uri.getPath();
- return pathStr;
- } catch (final URISyntaxException e) {
- throw new IllegalArgumentException("Cannot find resource: " +
shortFileName + LS + e);
- }
- }
-
/**
* Returns a byte array of the contents of the file defined by the given
resource file's
* shortFileName.
@@ -329,7 +302,7 @@ public final class Util {
*/
public static byte[] getResourceBytes(final String shortFileName) {
try {
- return Files.readAllBytes(Paths.get(getResourcePath(shortFileName)));
+ return Files.readAllBytes(getResourceFile(shortFileName).toPath());
} catch (final IOException e) {
throw new IllegalArgumentException("Cannot read resource: " +
shortFileName + LS + e);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]