diff --git a/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/App.java b/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/App.java index 473a2f03f..576458e0b 100644 --- a/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/App.java +++ b/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/App.java @@ -88,7 +88,7 @@ public class App { var statement = connection.createStatement()) { statement.execute(RoomSchemaSql.CREATE_SCHEMA_SQL); } catch (Exception e) { - throw new SqlException(e.getMessage(), e); + throw new Exception(e.getMessage(), e); } } diff --git a/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/HotelDaoImpl.java b/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/HotelDaoImpl.java index d1f90a98b..e64b64699 100644 --- a/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/HotelDaoImpl.java +++ b/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/HotelDaoImpl.java @@ -74,7 +74,7 @@ public class HotelDaoImpl implements HotelDao { } }); } catch (Exception e) { - throw new SqlException(e.getMessage(), e); + throw new Exception(e.getMessage(), e); } } @@ -92,8 +92,8 @@ public class HotelDaoImpl implements HotelDao { } else { return Optional.empty(); } - } catch (Exception ex) { - throw new SqlException(ex.getMessage(), ex); + } catch (Exception e) { + throw new Exception(e.getMessage(), e); } finally { if (resultSet != null) { resultSet.close(); @@ -115,8 +115,8 @@ public class HotelDaoImpl implements HotelDao { statement.setBoolean(4, room.isBooked()); statement.execute(); return true; - } catch (Exception ex) { - throw new SqlException(ex.getMessage(), ex); + } catch (Exception e) { + throw new Exception(e.getMessage(), e); } } @@ -132,8 +132,8 @@ public class HotelDaoImpl implements HotelDao { statement.setBoolean(3, room.isBooked()); statement.setInt(4, room.getId()); return statement.executeUpdate() > 0; - } catch (Exception ex) { - throw new SqlException(ex.getMessage(), ex); + } catch (Exception e) { + throw new Exception(e.getMessage(), e); } } @@ -143,8 +143,8 @@ public class HotelDaoImpl implements HotelDao { var statement = connection.prepareStatement("DELETE FROM ROOMS WHERE ID = ?")) { statement.setInt(1, room.getId()); return statement.executeUpdate() > 0; - } catch (Exception ex) { - throw new SqlException(ex.getMessage(), ex); + } catch (Exception e) { + throw new Exception(e.getMessage(), e); } } @@ -159,7 +159,7 @@ public class HotelDaoImpl implements HotelDao { statement.close(); connection.close(); } catch (Exception e) { - throw new SqlException(e.getMessage(), e); + throw new Exception(e.getMessage(), e); } } diff --git a/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/SqlException.java b/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/SqlException.java deleted file mode 100644 index 369eb259d..000000000 --- a/transaction-script/src/main/java/com/ashishtrivedi16/transactionscript/SqlException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License - * Copyright © 2014-2019 Ilkka Seppälä - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package com.ashishtrivedi16.transactionscript; - -/** - * Custom exception. - */ -public class SqlException extends Exception { - - private static final long serialVersionUID = 1L; - - public SqlException() { - } - - public SqlException(String message) { - super(message); - } - - public SqlException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/transaction-script/src/test/java/com/ashishtrivedi16/transactionscript/HotelTest.java b/transaction-script/src/test/java/com/ashishtrivedi16/transactionscript/HotelTest.java index 86f4605b3..26bf4b5cd 100644 --- a/transaction-script/src/test/java/com/ashishtrivedi16/transactionscript/HotelTest.java +++ b/transaction-script/src/test/java/com/ashishtrivedi16/transactionscript/HotelTest.java @@ -114,7 +114,7 @@ public class HotelTest { var statement = connection.createStatement()) { statement.execute(RoomSchemaSql.CREATE_SCHEMA_SQL); } catch (Exception e) { - throw new SqlException(e.getMessage(), e); + throw new Exception(e.getMessage(), e); } }