This vulnerability occurs when a method is declared to throw an overly broad exception type, such as a generic 'Exception' or 'Throwable'. This practice masks the specific error conditions that can occur, making it difficult for calling code to handle failures appropriately.
Declaring a method to throw a generic exception like `Exception` forces callers into generic error handling. Instead of being able to anticipate and write specific recovery code for different failure scenarios—like `FileNotFoundException` versus `AccessDeniedException`—developers are left with a catch-all block. This obscures the root cause, often leading to inappropriate user responses and making debugging significantly harder. Catching these overly broad declarations manually is tedious, especially in large codebases. While SAST tools can flag the pattern, Plexicus uses AI to not only detect the issue but also suggest the precise, narrower exception types to declare, automating the remediation and saving valuable development time.
Impact: Hide ActivitiesAlter Execution Logic
Throwing a generic exception can hide details about unexpected adversary activities by making it difficult to properly troubleshoot error conditions during execution.
javajavac++