|
@@ -35,7 +35,7 @@ public class R2RMLProcessor {
|
|
this.configuration = configuration;
|
|
this.configuration = configuration;
|
|
}
|
|
}
|
|
|
|
|
|
- public void execute() {
|
|
|
|
|
|
+ public void execute() throws Exception {
|
|
createDatabaseConnection();
|
|
createDatabaseConnection();
|
|
|
|
|
|
String file = configuration.getMappingFile();
|
|
String file = configuration.getMappingFile();
|
|
@@ -70,7 +70,7 @@ public class R2RMLProcessor {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void createDatabaseConnection() {
|
|
|
|
|
|
+ private void createDatabaseConnection() throws Exception {
|
|
// Determine situation
|
|
// Determine situation
|
|
if (configuration.hasConnectionURL() && configuration.hasCSVFiles()) {
|
|
if (configuration.hasConnectionURL() && configuration.hasCSVFiles()) {
|
|
logger.error("You cannot provide a connection URL and a list of CSV files at the same time.");
|
|
logger.error("You cannot provide a connection URL and a list of CSV files at the same time.");
|
|
@@ -88,7 +88,8 @@ public class R2RMLProcessor {
|
|
connection = createTablesFromCSVFiles();
|
|
connection = createTablesFromCSVFiles();
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
logger.error("Exception during database startup.", ex);
|
|
logger.error("Exception during database startup.", ex);
|
|
- System.exit(-1);
|
|
|
|
|
|
+ throw ex;
|
|
|
|
+ // System.exit(-1);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
// Connecting to a database
|
|
// Connecting to a database
|
|
@@ -103,7 +104,7 @@ public class R2RMLProcessor {
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
logger.error("Error connecting to database.", e);
|
|
logger.error("Error connecting to database.", e);
|
|
- System.exit(-1);
|
|
|
|
|
|
+ // System.exit(-1);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -139,13 +140,14 @@ public class R2RMLProcessor {
|
|
return name;
|
|
return name;
|
|
}
|
|
}
|
|
|
|
|
|
- private void closeDatabaseConnection() {
|
|
|
|
|
|
+ private void closeDatabaseConnection() throws SQLException {
|
|
try {
|
|
try {
|
|
if (!connection.isClosed())
|
|
if (!connection.isClosed())
|
|
connection.close();
|
|
connection.close();
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
logger.error("Error closing connection with database.", e);
|
|
logger.error("Error closing connection with database.", e);
|
|
- System.exit(-1);
|
|
|
|
|
|
+ throw e;
|
|
|
|
+ // System.exit(-1);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|