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
19 static int UNUSED_findNumberOfCommonFrames(StackTraceElement[] steArray,
20 StackTraceElement[] otherSTEArray) {
21 if (otherSTEArray == null) {
22 return 0;
23 }
24
25 int steIndex = steArray.length - 1;
26 int parentIndex = otherSTEArray.length - 1;
27 int count = 0;
28 while (steIndex >= 0 && parentIndex >= 0) {
29 if (steArray[steIndex].equals(otherSTEArray[parentIndex])) {
30 count++;
31 } else {
32 break;
33 }
34 steIndex--;
35 parentIndex--;
36 }
37 return count;
38 }
39
40
41 static int findNumberOfCommonFrames(StackTraceElement[] steArray,
42 StackTraceElementProxy[] otherSTEPArray) {
43 if (otherSTEPArray == null) {
44 return 0;
45 }
46
47 int steIndex = steArray.length - 1;
48 int parentIndex = otherSTEPArray.length - 1;
49 int count = 0;
50 while (steIndex >= 0 && parentIndex >= 0) {
51 if (steArray[steIndex].equals(otherSTEPArray[parentIndex].ste)) {
52 count++;
53 } else {
54 break;
55 }
56 steIndex--;
57 parentIndex--;
58 }
59 return count;
60 }
61 }