1111/**
1212 * This class provides helpfull stuff in order to easy patch object using Byteman rules
1313 *
14- * @param <ObjectType > The type of the object to patch
14+ * @param <T > The type of the object to patch
1515 */
16- public abstract class DDAgentTracingHelper <ObjectType > extends OpenTracingHelper {
16+ public abstract class DDAgentTracingHelper <T > extends OpenTracingHelper {
1717
1818 private static final Logger LOGGER = Logger .getLogger (DDAgentTracingHelper .class .getCanonicalName ());
1919
@@ -48,15 +48,22 @@ public abstract class DDAgentTracingHelper<ObjectType> extends OpenTracingHelper
4848 * @param args The object to patch, the type is defined by the subclass instantiation
4949 * @return The object patched
5050 */
51- public ObjectType patch (ObjectType args ) {
51+ public T patch (T args ) {
5252
53- info ("Try to patch " + args .getClass ().getName ());
54- ObjectType patched ;
53+ if (args == null ) {
54+ info ("Skipping " + rule .getName () + "' rule because the input arg is null" );
55+ return args ;
56+ }
57+
58+ String className = args .getClass ().getName ();
59+ info ("Try to patch " + className );
60+
61+ T patched ;
5562 try {
5663 patched = doPatch (args );
57- info (args . getClass (). getName () + " patched" );
64+ info (className + " patched" );
5865 } catch (Throwable e ) {
59- warning ("Failed to patch" + args . getClass (). getName () + ", reason: " + e .getMessage ());
66+ warning ("Failed to patch" + className + ", reason: " + e .getMessage ());
6067 logStackTrace (e .getMessage (), e );
6168 patched = args ;
6269 }
@@ -70,7 +77,7 @@ public ObjectType patch(ObjectType args) {
7077 * @return the object patched
7178 * @throws Exception The exceptions are managed directly to the patch method
7279 */
73- abstract protected ObjectType doPatch (ObjectType obj ) throws Exception ;
80+ abstract protected T doPatch (T obj ) throws Exception ;
7481
7582
7683 /**
0 commit comments