Skip to content

Commit

Permalink
fix: review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SivasaiPodugu committed Feb 15, 2024
1 parent 9b3d7d5 commit 6570e67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ public static ResponseData execute(String url, String query, Logger logger) thro
logger.info("Response data is empty, response length: " + resultStringBuilder.length());
throw new Exception("Response data is empty...");
}
statement.close();
resultSet.close();
return new ResponseData(resultStringBuilder.toString(), value);
} catch (Exception e) {
Objects.requireNonNull(statement).close();
Objects.requireNonNull(resultSet).close();
String errorMessage = ExceptionUtils.getStackTrace(e);
logger.info(errorMessage);
throw new Exception("Error occurred while executing the given query: " + errorMessage);
}
finally {
if(statement != null)
statement.close();
if(resultSet != null)
resultSet.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ public static String execute(String url, String query, Logger logger) throws Exc
}
resultStringBuilder.append("\n");
}
statement.close();
resultSet.close();
return resultStringBuilder.toString();
}
catch (Exception e){
Objects.requireNonNull(statement).close();
Objects.requireNonNull(resultSet).close();
throw new Exception(e);
}
finally {
if(statement != null)
statement.close();
if(resultSet != null)
resultSet.close();
}
}
}

0 comments on commit 6570e67

Please sign in to comment.