apex-malhar
apex-malhar copied to clipboard
APEXMALHAR-2566 Fixed NPE in FSWindowDataManager
Is it possible to come up with a unit test for this. Looks like the NPE happens only in some cases.
There are checkstyle errors, please see
[ERROR] src/main/java/org/apache/apex/malhar/lib/wal/FSWindowDataManager.java:[487,11] (whitespace) WhitespaceAround: WhitespaceAround: 'if' is not followed by whitespace. [ERROR] src/main/java/org/apache/apex/malhar/lib/wal/FSWindowDataManager.java:[488] (indentation) Indentation: 'reader' have incorrect indentation level 11, expected level should be 12.
This looks like an edge case as this code generally works and doesn't error always. If it is an edge case and you are unable to come up with a unit test due to that reason, if there is no objection from others, I am ok to merge it without a unit test in this case.
I am not fully convinced that this is the right fix without a unit test. Looking at readNext()
implementation, I would suspect that null
is returned when the next record was not fully written or there is actually I/O problem. It is not clear, why is it OK to suppress I/O exception in readNext()
instead of propagating it as retrieve()
signature suggests. For the incomplete written record, it should be possible to create a unit test and see what should be the correct behavior.
@patilvikram can you respond to @vrozov comments