[英]NullPointerException because the Thread is null?
I received this stack strace three times now during the last months. 在过去的几个月中,我现在已经三次收到该堆栈跟踪信息。 It's only these three lines:
只是以下三行:
java.lang.NullPointerException
at de.myapp.rec.MyThread.void run()(Unknown Source)
at java.lang.Thread.run(Thread.java:856)
I wonder if this could mean that the method MyThread.run
got null
? 我想知道这是否意味着
MyThread.run
方法为null
? Or are there other possible reasons for the NullPointerException
? 还是
NullPointerException
有其他可能的原因?
The thread is started via 线程通过启动
myThread = new Thread(new MyThread());
Rec.threadWritingShouldContinue = true;
myThread.start();
The source of the thread is about that: 线程的来源是关于:
class MyThread implements Runnable
{
@Override
public void run() {
while ( Rec.threadWritingShouldContinue ) {
int bufferSize;
/* Do some stuff with local variables
...
*/
try {
MyMain.fileIDwrite.write(Rec.bigBuffer, Rec.bigBufByteWritePtr, bufferSize);
} catch ( IOException e ) {
Rec.threadWritingShouldContinue = false;
}
}
}
}
Compiling with debug information wont help as it can last weeks to see it again. 使用调试信息进行编译将无济于事,因为它可以持续数周才能再次看到它。
I wonder if this could mean that the method MyThread.run is null?
我想知道这是否意味着方法MyThread.run为空?
No. Methods cannot be null. 不能。方法不能为空。
Or are there other possible reasons for the NullPointerException?
还是NullPointerException有其他可能的原因?
There is only one possible reason. 只有一种可能的原因。 The code dereferenced a null pointer.
该代码取消了对空指针的引用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.