From 046f2f79e3d5e375e737f521dbd554c3248b6b96 Mon Sep 17 00:00:00 2001
From: stevenbobo <sbobo3@illinois.edu>
Date: Wed, 18 Nov 2020 23:18:07 -0600
Subject: [PATCH] Added new FormValidationException to throw "no results
 returned" when database query results are empty.

---
 .../csc/itrust/dao/mysql/CauseOfDeathTrendsReportDAO.java     | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/CauseOfDeathTrendsReportDAO.java b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/CauseOfDeathTrendsReportDAO.java
index c3fd0c8..839566f 100644
--- a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/CauseOfDeathTrendsReportDAO.java
+++ b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/CauseOfDeathTrendsReportDAO.java
@@ -144,6 +144,8 @@ public class CauseOfDeathTrendsReportDAO {
 				causes.add(new CauseOfDeathTrendsReportBean(name, cause, deaths));
 				count++;
 			}
+			if (causes.isEmpty())
+				throw new FormValidationException("No results returned");
 			rs.close();
 			stmt.close();
 		} catch (SQLException e) {
@@ -220,6 +222,8 @@ public class CauseOfDeathTrendsReportDAO {
 				causes.add(new CauseOfDeathTrendsReportBean(name, cause, deaths));
 				count++;
 			}
+			if (causes.isEmpty())
+				throw new FormValidationException("No results returned");
 			rs.close();
 			stmt.close();
 		} catch (SQLException e) {
-- 
GitLab