Fixed issue where Queries.json would not load

This commit is contained in:
Rohit Awate 2018-02-14 11:39:34 +05:30
parent 26b740feab
commit 81710e9d15
2 changed files with 5 additions and 4 deletions

3
.gitignore vendored
View file

@ -5,4 +5,5 @@ RESTaurant.iml
classes/
src/main/java/META-INF/
dependency-reduced-pom.xml
!/requests.sqlite
history.sqlite
themes/

View file

@ -24,7 +24,7 @@ import com.rohitawate.restaurant.models.requests.GETRequest;
import com.rohitawate.restaurant.models.requests.RestaurantRequest;
import com.rohitawate.restaurant.util.json.JSONUtils;
import java.io.File;
import java.io.InputStream;
import java.sql.*;
import java.time.LocalDate;
import java.util.Map;
@ -36,10 +36,10 @@ public class HistoryManager {
public HistoryManager() {
try {
conn = DriverManager.getConnection("jdbc:sqlite:requests.sqlite");
conn = DriverManager.getConnection("jdbc:sqlite:history.sqlite");
// Read all queries from Queries.json
File queriesFile = new File(getClass().getResource("/sql/Queries.json").toURI());
InputStream queriesFile = getClass().getResourceAsStream("/sql/Queries.json");
ObjectMapper mapper = new ObjectMapper();
queries = mapper.readTree(queriesFile);