When the size of the data buffer does not fit the tile size, the output written by the WriteOp is not correct.
This case should not occur often. Otherwise it would have been detected by the tests on the build server.
In the code Tile.getDataBuffer() is used. The method which should be used is Tile.getRawSamples().
This is in line with the API documentation.