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

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury.git


The following commit(s) were added to refs/heads/main by this push:
     new c5ab2a2f fix(java): fix DisallowedList calculate hash in Windows 
(#2142)
c5ab2a2f is described below

commit c5ab2a2f1d934312bebb253c8b5b698aacb94f25
Author: monk <[email protected]>
AuthorDate: Sat Apr 12 15:32:25 2025 +0800

    fix(java): fix DisallowedList calculate hash in Windows (#2142)
    
    <!--
    **Thanks for contributing to Fury.**
    
    **If this is your first time opening a PR on fury, you can refer to
    
[CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).**
    
    Contribution Checklist
    
    - The **Apache Fury (incubating)** community has restrictions on the
    naming of pr titles. You can also find instructions in
    [CONTRIBUTING.md](https://github.com/apache/fury/blob/main/CONTRIBUTING.md).
    
    - Fury has a strong focus on performance. If the PR you submit will have
    an impact on performance, please benchmark it first and provide the
    benchmark result here.
    -->
    
    ## What does this PR do?
    It appears that [PR #2128](https://github.com/apache/fury/pull/2128) did
    not truly resolve this issue, as it only modified the test case code
    without addressing the actual runtime logic. This PR re-fixes the
    problem.
    <!-- Describe the purpose of this PR. -->
    
    ## Related issues
    
    <!--
    Is there any related issue? Please attach here.
    
    - #xxxx0
    - #xxxx1
    - #xxxx2
    -->
    
    ## Does this PR introduce any user-facing change?
    
    <!--
    If any user-facing interface changes, please [open an
    issue](https://github.com/apache/fury/issues/new/choose) describing the
    need to do so and update the document if necessary.
    -->
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
    
    <!--
    When the PR has an impact on performance (if you don't know whether the
    PR will have an impact on performance, you can submit the PR first, and
    if it will have impact on performance, the code reviewer will explain
    it), be sure to attach a benchmark data here.
    -->
---
 .../src/main/java/org/apache/fury/resolver/DisallowedList.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/java/fury-core/src/main/java/org/apache/fury/resolver/DisallowedList.java 
b/java/fury-core/src/main/java/org/apache/fury/resolver/DisallowedList.java
index b4808726..5f907a84 100644
--- a/java/fury-core/src/main/java/org/apache/fury/resolver/DisallowedList.java
+++ b/java/fury-core/src/main/java/org/apache/fury/resolver/DisallowedList.java
@@ -19,13 +19,14 @@
 
 package org.apache.fury.resolver;
 
+import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.Arrays;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.stream.Collectors;
@@ -47,10 +48,9 @@ class DisallowedList {
     try (InputStream is =
         
DisallowedList.class.getClassLoader().getResourceAsStream(DISALLOWED_LIST_TXT_PATH))
 {
       if (is != null) {
-        byte[] fileBytes = readAllBytes(is);
         DEFAULT_DISALLOWED_LIST_SET =
-            Arrays.stream(
-                    new String(fileBytes, 
StandardCharsets.UTF_8).split(System.lineSeparator()))
+            new BufferedReader(new InputStreamReader(is, 
StandardCharsets.UTF_8))
+                .lines()
                 .filter(line -> !line.isEmpty() && !line.startsWith("#"))
                 .collect(Collectors.toSet());
         String calculatedHash = calculateSHA256(new 
TreeSet<>(DEFAULT_DISALLOWED_LIST_SET));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to