Commit 02eee31
committed
Fix stack locator calc location on JDK 9
This commit fixes a bug in StackLocator#calcLocation on JDK 9. The
particular issue here is that on JDK 9, all stack trace locations report
as line 71 of StackLocatorUtil. This is due to a bug in the JDK 9
implementation of StackLocator. The bug is that instead of dropping the
top frames of the stack until the first frame that matches the
fully-qualified class name of the logger, the implementation would drop
all frames from the top that match the fully-qualified class name of the
logger. Of course, at this point in the stack trace, there would be
none. The fix is to reverse the condition, that we drop all frames until
we reach a frame matching the fully-qualified class name of the logger,
and then drop all frames matching the fully-qualified class name of the
logger. This commit also adds a test that was broken before this change
and now passes.1 parent e67bf82 commit 02eee31
File tree
2 files changed
+53
-5
lines changed- log4j-api-java9/src
- main/java/org/apache/logging/log4j/util
- test/java/org/apache/logging/log4j/util
2 files changed
+53
-5
lines changedLines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
Lines changed: 47 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
26 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
94 | 138 | | |
95 | 139 | | |
96 | 140 | | |
| |||
0 commit comments