diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-05-11 13:57:27 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-05-11 13:57:27 +0200 |
commit | cffee33f9fcad20cf9e41f6a847841f1c1390af2 (patch) | |
tree | f8da67a4474f821a2539ed11653293b3e8ff3e61 | |
parent | dfe27ab80266b7191e36cbc95f3cd9dacafb6c5f (diff) | |
download | Datafiller-cffee33f9fcad20cf9e41f6a847841f1c1390af2.tar.gz |
Are you stupid? Converting SQLException to RuntimeException?!
-rw-r--r-- | src/main/DataFiller.java | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/main/DataFiller.java b/src/main/DataFiller.java index 437fcdb..803d926 100644 --- a/src/main/DataFiller.java +++ b/src/main/DataFiller.java @@ -8,8 +8,6 @@ import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; /** * Process that incoming tweets and fill the database. @@ -35,20 +33,17 @@ public class DataFiller { * Create the datafiller object. * * @param connection The database connection to use. + * @throws java.sql.SQLException on error preparing the database connection. */ - public DataFiller(Connection connection) { - try { - m_connection = connection; - m_insertTweet = new NamedPreparedStatement(m_connection, QueryUtils.insertTweet); - m_insertProfile = new NamedPreparedStatement(m_connection, QueryUtils.insertProfile); - m_insertBrand = new NamedPreparedStatement(m_connection, QueryUtils.insertBrand); - m_insertHash = new NamedPreparedStatement(m_connection, QueryUtils.insertHash); - m_insertTweetUrl = new NamedPreparedStatement(m_connection, QueryUtils.insertTweetUrl); - m_insertUserUrl = new NamedPreparedStatement(m_connection, QueryUtils.insertUserUrl); - m_insertMentions = new NamedPreparedStatement(m_connection, QueryUtils.insertMentions); - } catch (SQLException ex) { - throw new RuntimeException(ex.getMessage()); - } + public DataFiller(Connection connection) throws SQLException { + m_connection = connection; + m_insertTweet = new NamedPreparedStatement(m_connection, QueryUtils.insertTweet); + m_insertProfile = new NamedPreparedStatement(m_connection, QueryUtils.insertProfile); + m_insertBrand = new NamedPreparedStatement(m_connection, QueryUtils.insertBrand); + m_insertHash = new NamedPreparedStatement(m_connection, QueryUtils.insertHash); + m_insertTweetUrl = new NamedPreparedStatement(m_connection, QueryUtils.insertTweetUrl); + m_insertUserUrl = new NamedPreparedStatement(m_connection, QueryUtils.insertUserUrl); + m_insertMentions = new NamedPreparedStatement(m_connection, QueryUtils.insertMentions); } /** |