Route DEX analysis exceptions to exceptionHandler#13
Conversation
… ignoring Co-authored-by: Howard20181 <40033067+Howard20181@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates DEX analysis error handling in HookBuilderImpl so exceptions thrown during dex.visitDefinedClasses() are no longer silently ignored and can be reported via the optional user-configured exceptionHandler.
Changes:
- Route
dex.visitDefinedClasses()failures toexceptionHandlerinstead of swallowing them.
Comments suppressed due to low confidence (1)
helper/src/main/java/io/github/libxposed/helper/HookBuilderImpl.java:1873
- Potentially confusing name: method doMatch also refers to field parameterCount (as this.parameterCount).
final int parameterCount;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } catch (Throwable e) { | ||
| if (exceptionHandler != null) exceptionHandler.test(e); | ||
| } |
There was a problem hiding this comment.
This catch block always suppresses exceptions from dex.visitDefinedClasses() regardless of the exceptionHandler’s return value. HookBuilder.setExceptionHandler() is documented as returning false to rethrow; consider honoring that contract here (e.g., rethrow when handler is null or returns false) so callers can fail fast instead of continuing with potentially partial analysis results.
Addresses feedback from PR #2 where
dex.visitDefinedClasses()exceptions were silently dropped, potentially leaving invocation/field maps partially populated without observable failure.Changes
catch (Throwable ignored)with routing toexceptionHandlerwhen configuredThis aligns with the exception handling pattern used throughout the method (lines 777-779, 804-805) where DEX analysis errors are reported via the optional user-configured handler.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.