Skip to content

Commit

Permalink
[FEDE-5144] Fix the static initialization of MemoryUtil (#17)
Browse files Browse the repository at this point in the history
* Remove unecessary setAccessible call

* Catch all errors thrown by the setAccessible call

New version of java can throw InaccessibleObjectException which Arrow
didn't handle
  • Loading branch information
scampi committed Nov 25, 2021
1 parent 418aaf6 commit f243f2a
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public Object run() {

// get the offset of the address field in a java.nio.Buffer object
Field addressField = java.nio.Buffer.class.getDeclaredField("address");
addressField.setAccessible(true);
BYTE_BUFFER_ADDRESS_OFFSET = UNSAFE.objectFieldOffset(addressField);

Constructor<?> directBufferConstructor;
Expand All @@ -99,10 +98,7 @@ public Object run() {
constructor.setAccessible(true);
logger.debug("Constructor for direct buffer found and made accessible");
return constructor;
} catch (NoSuchMethodException e) {
logger.debug("Cannot get constructor for direct buffer allocation", e);
return e;
} catch (SecurityException e) {
} catch (Exception e) {
logger.debug("Cannot get constructor for direct buffer allocation", e);
return e;
}
Expand Down

0 comments on commit f243f2a

Please sign in to comment.