← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11230: Returning null instead of throwing exception for getDataValue metod

 

------------------------------------------------------------
revno: 11230
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-06-19 16:53:07 +0200
message:
  Returning null instead of throwing exception for getDataValue metod
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2013-05-24 12:59:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2013-06-19 14:53:07 +0000
@@ -58,6 +58,7 @@
 import org.hisp.dhis.system.util.ConversionUtils;
 import org.hisp.dhis.system.util.MathUtils;
 import org.hisp.dhis.system.util.TextUtils;
+import org.springframework.dao.EmptyResultDataAccessException;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
 
@@ -171,7 +172,14 @@
             "AND periodid = " + periodId + " " +
             "AND sourceid = " + sourceId;
         
-        return jdbcTemplate.queryForObject( sql, new DataValueRowMapper() );
+        try
+        {
+            return jdbcTemplate.queryForObject( sql, new DataValueRowMapper() );
+        }
+        catch ( EmptyResultDataAccessException ex )
+        {
+            return null;
+        }
     }
     
     // -------------------------------------------------------------------------