chanani commented on PR #4049:
URL: https://github.com/apache/logging-log4j2/pull/4049#issuecomment-3987877054

   Hi @vy,
   
   The reason `NoClassDefFoundError` doesn't surface with the existing test 
suite is the difference between two exception paths:
   
   1. **`ClassNotFoundException` (extends `Exception`)** — Thrown by 
`ClassLoader.loadClass()` when a class simply doesn't exist on the classpath. 
That's the case for `bar.OrgApacheReplacement` — it was never on the classpath, 
so the class loader search fails cleanly with `ClassNotFoundException`, which 
was already caught by the previous `catch (Exception)`
   
   2. **`NoClassDefFoundError` (extends `LinkageError` → `Error`)** — Thrown 
when the class is found but fails during linking/initialization (e.g., a 
missing dependency at link time). This is the scenario from issue #4028, and it 
wasn't caught by `catch (Exception)`
   
   So the existing test with `ORG_APACHE_REPLACEMENT_STACK_TRACE_ELEMENT` 
exercises the `ClassNotFoundException` path, not the `NoClassDefFoundError` path
   
   Please let me know if any further changes are needed !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to