You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if Factory#create throws an exception the result is a stack trace that includes no information about the ServiceLocator:
Exception in thread "main" MultiException stack 1 of 3
java.lang.RuntimeException: test!!!
...
at org.jvnet.hk2.internal.FactoryCreator.create(FactoryCreator.java:129)
at org.jvnet.hk2.internal.AutoActiveDescriptor.create(AutoActiveDescriptor.java:148)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:458)
...
MultiException stack 2 of 3
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of Foo errors were found
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:224)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:334)
at org.jvnet.hk2.internal.AutoActiveDescriptor.create(AutoActiveDescriptor.java:148)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:458)
Similar to #491 when HK2 encounters an exception while resolving dependencies it really should include the name amd LocatorId of the ServiceLocator that failed. In applications that include a hierarchy of ServiceLocators this would allow such problems to be quickly tracked down to the source.
The text was updated successfully, but these errors were encountered:
I really don't know, to tell you the truth. Legal looks at this stuff, says "No" and there's not much room for debate. It's not really clear that that they even understand what they're looking at.
If there was a way for me to easily submit a PR I would. There's a single class, FactoryCreator#129 that seems to implement the logic of calling Factory#provide().
The actual fix is pretty straightforwards I think:
A new exception class should be introduced: DependencyProvisioningException extends HK2RuntimeException. This class should have a constructor that takes a ServiceLocator. It should have a static method that formulates a meaningful message to include the ServiceLocator name/locatorId.
If Factory#provide throws an (Runtime)Exception this exception could caught and wrapped in a DependencyProvisioningException as the 'cause'.
Currently if Factory#create throws an exception the result is a stack trace that includes no information about the ServiceLocator:
Similar to #491 when HK2 encounters an exception while resolving dependencies it really should include the name amd LocatorId of the ServiceLocator that failed. In applications that include a hierarchy of ServiceLocators this would allow such problems to be quickly tracked down to the source.
The text was updated successfully, but these errors were encountered: