code: protected static String getFirstApplicationStackString() {
          // Don't do trace in this method as it would only confuse the issue
          // to see a full stack trace.
          String val = null;
  
          Exception e = new Exception();
          StackTraceElement[] ste = e.getStackTrace();
  
          String jmsImplPackageName = JmsErrorUtils.class.getPackage().getName();
  
          // The elements of the stack start at 0 with an entry for this method, and
          // get closer to the application as the indices increase. We are looking for
          // the first entry that isn't in the jms.impl package.
  
          // Start at index 1, because sometimes the Throwable constructor gets into
          // the stack trace too. We know that there is at least two lines in the stack
          // trace because this method has been called by someone else in the JMS component.
          for (int i = 1; i < ste.length; i++) {
  
              // Class name includes the package name.
              String recordClassName = ste[i].getClassName();
              if (!recordClassName.startsWith(jmsImplPackageName)) {
                  // We have found the first non-JMS entry.
                  val = ste[i].toString();
                  // Leave the loop immediately.
                  break;
              }
          }
  
          return val;
      }
docs: Investigates the current call stack when the method is called to return
  a string describing the line of customer application code that was responsible
  for calling into the JMS component package (...sib.api.jms.impl)
  
  This method is used for providing assistance to the user in tracking down
  badly behaved code. Note that this method should only be used in error cases
  due to the performance implications of creating a new exception each time it
  is called.
  
  @return String describing the relevant line of application code.