Exceptions while iterating sets
mark3smith opened this issue · comments
I'm getting an exception at the end of a loop that is iterating instances of JavaSet. I think it may be happening on other collections also but haven't verified. The operation completes successfully and if you didn't have logging turned on you wouldn't know there was a problem. Attached (hopefully) is my Java, Python and log files.
pytest.py.txt
TestEntryPoint.java.txt
log.txt
Should have added that I'm using Py4j 0.10.9.1 on Java 8 on a Mac
Related: #403
Could you please check if #453 fixes this for you? Thanks!
This exception is intentionally caused in java_collections.py near line 57 when the code loops through a Java iterator without checking the hasNext() but instead just loops until a Java exception (NoSuchElementException) is fired. The Java code on the other side is so generic there's no way to prevent it there. The only solution I see is changing the Python to add the hasNext() check