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

stoty pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.5 by this push:
     new 6e24cd29c2a HBASE-29234 Handle 
java.lang.reflect.InaccessibleObjectException in HFileSystem (#6873)
6e24cd29c2a is described below

commit 6e24cd29c2a68528949713a5d9407b28e1ee8a92
Author: Istvan Toth <[email protected]>
AuthorDate: Tue Apr 1 12:26:43 2025 +0200

    HBASE-29234 Handle java.lang.reflect.InaccessibleObjectException in 
HFileSystem (#6873)
    
    Signed-off-by: Duo Zhang <[email protected]>
    (cherry picked from commit c20de4a978bcee0cfe451c2a83f9d4ae4b965a1e)
---
 .../main/java/org/apache/hadoop/hbase/fs/HFileSystem.java   | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java
index f893e6d73c4..1a8e5cc4c77 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java
@@ -338,12 +338,17 @@ public class HFileSystem extends FilterFileSystem {
       nf.set(dfsc, cp1);
       LOG.info("Added intercepting call to namenode#getBlockLocations so can 
do block reordering"
         + " using class " + lrb.getClass().getName());
-    } catch (NoSuchFieldException e) {
-      LOG.warn("Can't modify the DFSClient#namenode field to add the location 
reorder.", e);
-      return false;
-    } catch (IllegalAccessException e) {
+    } catch (NoSuchFieldException | IllegalAccessException e) {
       LOG.warn("Can't modify the DFSClient#namenode field to add the location 
reorder.", e);
       return false;
+    } catch (Exception e) {
+      // InaccessibleObjectException was added in Java 9, need this for Java 8
+      if (e.getClass().getSimpleName().equals("InaccessibleObjectException")) {
+        LOG.warn("Can't modify the DFSClient#namenode field to add the 
location reorder.", e);
+        return false;
+      } else {
+        throw e;
+      }
     }
 
     return true;

Reply via email to