in src/main/java/org/apache/sling/tracer/internal/CallerFinder.java [42:63]
public StackTraceElement determineCaller(StackTraceElement[] stack) {
if (stack == null) {
return null;
}
for (int i = stack.length - 1; i >= 0; i--) {
StackTraceElement current = stack[i];
if (i > 0) {
StackTraceElement next = stack[i - 1];
//now scan each element and check if the *next* stack element belongs to any
//api package. If yes then current stack would be the caller
for (String pkg : apiPkgs) {
if (next.getClassName().startsWith(pkg)) {
return current;
}
}
}
}
return null;
}