private void setReasonableInformation(Exception exception, int reason, String[] inserts)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setReasonableInformation", new Object[]{exception, reason, inserts});
      boolean injectedReason = reason == Reasonable.DEFAULT_REASON;
      boolean injectedInserts = inserts == Reasonable.DEFAULT_INSERTS;
      Throwable nextThrowable = exception;


      while ((nextThrowable != null) &&
             (!injectedReason || !injectedInserts))
      {
         if ((nextThrowable instanceof Reasonable) ||
             (nextThrowable instanceof SIException) ||
             (nextThrowable instanceof SIErrorException))
         {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Attempting to add reasonable information for exception of type: "+nextThrowable.getClass());
            if (!injectedReason)
            {
               try
               {
                  Method setReasonMethod =
                     nextThrowable.getClass().getMethod("setExceptionReason", new Class<?>[]{int.class});

                  setReasonMethod.invoke(nextThrowable, new Object[]{reason});

                  injectedReason = true;
               }
               catch(NoSuchMethodException e)
               {
                  // No FFDC code needed.
               }
               catch (Exception e)
               {
                  FFDCFilter.processException(e, CLASS_NAME + ".setReasonableInformation",
                                              CommsConstants.COMMSBYTEBUFFER_SETREASONABLE_01,
                                              this);
                  if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, e);
               }
            }

            if (!injectedInserts)
            {
               try
               {
                  Method setInsertsMethod =
                     nextThrowable.getClass().getMethod("setExceptionInserts", new Class<?>[]{String[].class});

                  setInsertsMethod.invoke(nextThrowable, new Object[]{inserts});

                  injectedInserts = true;
               }
               catch(NoSuchMethodException e)
               {
                  // No FFDC code needed.
               }
               catch (Exception e)
               {
                  FFDCFilter.processException(e, CLASS_NAME + ".setReasonableInformation",
                                              CommsConstants.COMMSBYTEBUFFER_SETREASONABLE_02,
                                              this);
                  if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, e);
               }
            }
         }
         else
         {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Exception ("+exception+") is not a type which can have a reason or inserts set on it.");
         }

         nextThrowable = nextThrowable.getCause();
      }
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setReasonableInformation");
   }
private void setReasonableInformation ( Exception exception , int reason , String [ ] inserts ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setReasonableInformation" , new Object [ ] { exception , reason , inserts } ) ; boolean injectedReason = reason == Reasonable . DEFAULT_REASON ; boolean injectedInserts = inserts == Reasonable . DEFAULT_INSERTS ; Throwable nextThrowable = exception ; while ( ( nextThrowable != null ) && ( ! injectedReason || ! injectedInserts ) ) { if ( ( nextThrowable instanceof Reasonable ) || ( nextThrowable instanceof SIException ) || ( nextThrowable instanceof SIErrorException ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Attempting to add reasonable information for exception of type: " + nextThrowable . getClass ( ) ) ; if ( ! injectedReason ) { try { Method setReasonMethod = nextThrowable . getClass ( ) . getMethod ( "setExceptionReason" , new Class < ? > [ ] { int . class } ) ; setReasonMethod . invoke ( nextThrowable , new Object [ ] { reason } ) ; injectedReason = true ; } catch ( NoSuchMethodException e ) { } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".setReasonableInformation" , CommsConstants . COMMSBYTEBUFFER_SETREASONABLE_01 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . exception ( this , tc , e ) ; } } if ( ! injectedInserts ) { try { Method setInsertsMethod = nextThrowable . getClass ( ) . getMethod ( "setExceptionInserts" , new Class < ? > [ ] { String [ ] . class } ) ; setInsertsMethod . invoke ( nextThrowable , new Object [ ] { inserts } ) ; injectedInserts = true ; } catch ( NoSuchMethodException e ) { } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".setReasonableInformation" , CommsConstants . COMMSBYTEBUFFER_SETREASONABLE_02 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . exception ( this , tc , e ) ; } } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Exception (" + exception + ") is not a type which can have a reason or inserts set on it." ) ; } nextThrowable = nextThrowable . getCause ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setReasonableInformation" ) ; }
Sets Reasonable information into a chain of exceptions.  This is done by scanning
down the chain of exceptions looking for exceptions that implement the Reasonable
interface (or have either the SIException or SIErrorException in their inheritence
hierarchy) and also have setters for reason or inserts.

@param exception  the top level exception in a chain of one or more exceptions, to set
the Reasonable information into.

@param reason  the reason information to set into the first exception which implements
the Reasonable interface (or is one of a handful of other exception types)
and has a setExceptionReason(int) method.  Note that if a value of
Reasonable.DEFAULT_REASON is specified then no attempt will be made to set
a reason value into any exception.

@param inserts  the inserts information to set into the first exception which implements
the Reasonable interface (or is one of a handful of other exception types)
and has a setExceptionInserts(String[]) method.  Note that if a value of
Reasonable.DEFAULT_INSERTS is specified then no attempt will be made to set
a inserts value into any exception.