public Site(StackTraceElement[] site) { this.site = site; int i = 0; while (!THIS_FILE_NAME.equals(site[i].getFileName())) { i++; } while (THIS_FILE_NAME.equals(site[i].getFileName())) { i++; } assert Utils.check(i < site.length - 1); this.offset = i; }
public static void printSite(Site s, StringBuilder out) { if (s == null) { out.append("(null)"); return; } StackTraceElement[] st = s.site(); int interestingSitesPrinted = 0; for (int i = s.offset; i < st.length; i++) { StackTraceElement e = st[i]; String fileName = e.getFileName(); if (THIS_FILE_NAME.equals(fileName)) { continue; } out.append(" " + e.getMethodName() + "(" + e.getFileName() + ":" + e.getLineNumber() + ")"); interestingSitesPrinted++; if (interestingSitesPrinted <= SITES_TO_PRINT) { continue; } if (fileName == null || "View.java".equals(fileName)) { continue; } String methodName = e.getMethodName(); if (skipMethods.contains(methodName)) { continue; } break; } }