Here you can find the source of getStackTrace(Throwable t, String[] allow, String[] deny)
public static StackTraceElement[] getStackTrace(Throwable t, String[] allow, String[] deny)
//package com.java2s; import java.util.ArrayList; public class Main { /**// w ww. j av a2 s . c o m * Returns stack trace filtered by class names. */ public static StackTraceElement[] getStackTrace(Throwable t, String[] allow, String[] deny) { StackTraceElement[] st = t.getStackTrace(); ArrayList<StackTraceElement> result = new ArrayList<>(st.length); elementLoop: for (StackTraceElement element : st) { String className = element.getClassName(); if (allow != null) { boolean validElemenet = false; for (String filter : allow) { if (className.indexOf(filter) != -1) { validElemenet = true; break; } } if (validElemenet == false) { continue; } } if (deny != null) { for (String filter : deny) { if (className.indexOf(filter) != -1) { continue elementLoop; } } } result.add(element); } st = new StackTraceElement[result.size()]; return result.toArray(st); } }