Website content quality is poor, distribution efficiency is too low how to do?Huawei engineers offer 5 unique skills>>>
When debugging a java program, when checking the value of an object in the breakpoint, the above error appears: com.sun.jdi.invocationexception occurred invoking method, which shows that an exception occurred during the call, as shown in the figure
Object is an ArrayList object. At first, I thought there was something wrong with the content of the object, so let’s take a look at the content of the list, as follows
An exception with a null pointer is displayed, but the exception with a null pointer is an error occurred when the details are formatted. That is to say, the value of the current array cannot be displayed during debug, so an exception with a null pointer is displayed. Then I went to stackflow to see the answers of the gods. They all said it was a toString () problem, so I went to see the corresponding class. If I really rewritten the toString () method, there was a problem when calling the toString () method when the debug value was displayed. However, this problem does not affect the operation of the program, but only affects the debug debugging
Solution: check whether the toString () method is rewritten, and whether the rewriting is reasonable and standard
Reference link: https://stackoverflow.com/questions/4123628/com-sun-jdi-invocationexception-occurred-invoking-method
It is also said that rewriting the hashcode () method will also cause this error, but I haven’t encountered it yet. From the debugging point of view, the debugger should call the toString () method, but I don’t know why the hashcode () method has an impact
Similar Posts:
- How to Solve Request processing failed; nested exception is java.lang.NullPointerException
- malloc: *** error for object pointer being freed [How to Solve]
- Web Console﹕ Uncaught Error: Error calling method
- [Solved] IllegalArgumentException: object is not an instance of declaring class
- Several cases of error reporting in java.lang.nullpointerexception
- [Solved] IDEA Unboxing of ‘stringRedisTemplate.hasKey(xx)’ may produce ‘NullPointerException’
- How to Solve Console error: index: 0, size: 0
- Problems and solutions of Android studio importing new projects
- [Solved] Mvel user-defined function error: duplicate function
- [Solved] Vue router common problems (push error, push duplicate route refresh)