mirror of
https://github.com/valitydev/shumpune.git
synced 2024-11-06 02:25:22 +00:00
Fix npe
This commit is contained in:
parent
d951db6de5
commit
a271e6f674
@ -204,7 +204,7 @@ public class PlanDaoImpl extends NamedParameterJdbcDaoSupport implements PlanDao
|
||||
"from shm.posting_log " +
|
||||
"where plan_id = :planId and batch_id= :batchId";
|
||||
|
||||
return getNamedParameterJdbcTemplate().queryForObject(sqlGetClock, params, Long.class);
|
||||
return queryForLong(params, sqlGetClock);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -215,7 +215,13 @@ public class PlanDaoImpl extends NamedParameterJdbcDaoSupport implements PlanDao
|
||||
"from shm.posting_log " +
|
||||
"where from_account_id = :accId or to_account_id= :accId";
|
||||
|
||||
return getNamedParameterJdbcTemplate().queryForObject(sqlGetClock, params, Long.class);
|
||||
return queryForLong(params, sqlGetClock);
|
||||
}
|
||||
|
||||
private long queryForLong(MapSqlParameterSource params, String sqlGetClock) {
|
||||
Long clock = getNamedParameterJdbcTemplate()
|
||||
.queryForObject(sqlGetClock, params, Long.class);
|
||||
return clock != null ? clock : 0L;
|
||||
}
|
||||
|
||||
private void checkBatchUpdate(int[][] updateCounts) {
|
||||
|
@ -293,6 +293,10 @@ public class ShumpuneServiceHandlerTest extends DaoTestBase {
|
||||
Balance balanceSecond = handler.getBalanceByID(firstAcc, Clock.latest(new LatestClock()));
|
||||
|
||||
Assert.assertEquals(balance.getClock(), balanceSecond.getClock());
|
||||
|
||||
Balance unknownAccount = handler.getBalanceByID(12321L, Clock.latest(new LatestClock()));
|
||||
|
||||
Assert.assertEquals(0L, unknownAccount.getOwnAmount());
|
||||
}
|
||||
|
||||
private void assertAccount(Account account, AccountPrototype accountPrototype) {
|
||||
|
Loading…
Reference in New Issue
Block a user