Set the appropriate parameters when calling the Logger method#4377
Set the appropriate parameters when calling the Logger method#4377hapihu wants to merge 1 commit intoapache:masterfrom
Conversation
| position = null; | ||
| log.debug(">>> Lock {} released token={} at {}", this.hashCode(), | ||
| Thread.currentThread().getStackTrace()[2]); | ||
| position = Thread.currentThread().getStackTrace()[2].toString(); |
There was a problem hiding this comment.
Can Thread.currentThread().getStackTrace()[2] return null?
There was a problem hiding this comment.
-
This method Thread.currentThread().getStackTrace() will not return null.
-
StackTraceElement[] array = Thread.currentThread().getStackTrace();
Usually, the length of array is greater than or equal to 2 when the thread is running.
I did a test.
The length is 2,when this method was called in Main(),otherwise the length is greater than 2.
-
Also, I ran the test case(unlock) in org.apache.bookkeeper.mledger.util.CallbackMutexTest.java.
The test results were normal. -
So, I think calling here, Thread.currentThread().getStackTrace()[2] will not return null.
|
Let me verify it a little bit more; |
Not enough arguments for Logger's method.
Set the appropriate parameters when calling the Logger method.