Look at: org.mariadb.jdbc.MariaDbPreparedStatementClient#executeBatch():
Calling commandEnd() before getUpdateCounts() (for CmdInformationBatch) causes the latter returning a value like [-2, -2, -2, ...] so no actual count is returned. But when you change the order (getUpdateCounts() before commandEnd()) then the first element of returned array contains actual update count.
I'm not sure whether that change would lead to other problems.
A similar situation is in executeLargeBatch().