1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.classic.spi;
15
16 public class STEUtil {
17
18 static int UNUSED_findNumberOfCommonFrames(StackTraceElement[] steArray, StackTraceElement[] otherSTEArray) {
19 if (otherSTEArray == null) {
20 return 0;
21 }
22
23 int steIndex = steArray.length - 1;
24 int parentIndex = otherSTEArray.length - 1;
25 int count = 0;
26 while (steIndex >= 0 && parentIndex >= 0) {
27 if (steArray[steIndex].equals(otherSTEArray[parentIndex])) {
28 count++;
29 } else {
30 break;
31 }
32 steIndex--;
33 parentIndex--;
34 }
35 return count;
36 }
37
38 static int findNumberOfCommonFrames(StackTraceElement[] steArray, StackTraceElementProxy[] otherSTEPArray) {
39 if (otherSTEPArray == null) {
40 return 0;
41 }
42
43 int steIndex = steArray.length - 1;
44 int parentIndex = otherSTEPArray.length - 1;
45 int count = 0;
46 while (steIndex >= 0 && parentIndex >= 0) {
47 if (steArray[steIndex].equals(otherSTEPArray[parentIndex].ste)) {
48 count++;
49 } else {
50 break;
51 }
52 steIndex--;
53 parentIndex--;
54 }
55 return count;
56 }
57 }