Skip to content

Commit

Permalink
fix no such method: sun.misc.Resource.getDataError()Exception/invokeV…
Browse files Browse the repository at this point in the history
…irtual
  • Loading branch information
InkerBot committed Jul 10, 2024
1 parent 2fd49cc commit d65f5c1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ private static MethodHandle createGetBytesImpl() {
private static MethodHandle createGetDataErrorImpl() {
try {
return UnsafeUtil.lookup().findVirtual(RESOURCE_CLASS, "getDataError", MethodType.methodType(Exception.class));
} catch (NoSuchMethodException e) {
return null;
} catch (Throwable e) {
return UnsafeUtil.unsafeThrow(e);
}
Expand All @@ -605,7 +607,11 @@ private Object instance() {

public Exception getDataError() {
try {
return (Exception) GET_DATA_ERROR.invoke(resource);
if (GET_DATA_ERROR == null) {
return null;
} else {
return (Exception) GET_DATA_ERROR.invoke(resource);
}
} catch (Throwable e) {
return UnsafeUtil.unsafeThrow(e);
}
Expand Down

0 comments on commit d65f5c1

Please sign in to comment.