DWQA QuestionsCategory: DatabaseThe question of Java multiple variable continuous equal sign assignment
New help 2 asked 4 weeks ago

QQ图片20200526201515.png
Note the location of the breakpoint. You have hit the next line of the operation.
As you can see, the newdtv on the far right is an object.
But!!! The leftmost and middle inputdtv and setterdtv are both null.
This is a very metaphysical problem. Under normal circumstances, all three variables can be assigned successfully for the same query.
But occasionally, it happens.
At one point I thought it was the JVM that suddenly cleaned up my variables.
This code, Microsoft’s msssql-jdbc 8. Jar11, parses the table field type.
Why?

imango replied 4 weeks ago

Since it’s a third-party package, you should interrupt and have a look. Search where it was written and hit a breakpoint. I think there are places in the code to put theinputDTVandsetterDTVSet directly tonullYou only know by interrupting. Since it happens occasionally, does this affect your actual results? Or are you just going to see how it’s written here, and if it affects the actual results, you have to go through itdebugTo find out the rules that happen occasionally, but certainly notgcAre the variables cleaned up by strong references, or are they mostly executed by other threads when you debuginputDTVsetterDTVSet tonullOperation of

2 Answers
imango answered 4 weeks ago

From the information that can be seen, the most likely only is that your source code and your running code do not match, that is, what you see in the source codeinputDTV = setterDTV = newDTVAt the beginning of this line is not assignment, but other statements unrelated to assignment. Your source code has been updated, but yourclassThe file is not updated, so there is no assignment in the actual running process
If you take yourinputDTVandsetterDTVThe color and whether it is italicized should be the common member variable of this class, so it is also possible that you are multithreaded in your operationdebugBefore this point, the value of the member variable was modified by another thread
In the first case, you just need to clean up the previous onesclassFile. Run it again to confirm it
If it’s the second case, you need to look at allinputDTVsetterDTVA judgment is added before the assignment. If the object to be assigned is empty, a paragraph will be printed to help you find the scene where the assignment is empty
Probably can think of these, hope to help you

Le Code answered 4 weeks ago

Order of operations?