Browse Source

removing system.exit which stops juma server"

Ademar Crotti Junior 5 years ago
parent
commit
11526d107b
1 changed files with 8 additions and 6 deletions
  1. 8 6
      src/r2rml/engine/R2RMLProcessor.java

+ 8 - 6
src/r2rml/engine/R2RMLProcessor.java

@@ -35,7 +35,7 @@ public class R2RMLProcessor {
 		this.configuration = configuration;
 	}
 
-	public void execute() {
+	public void execute() throws Exception {
 		createDatabaseConnection();
 
 		String file = configuration.getMappingFile();
@@ -70,7 +70,7 @@ public class R2RMLProcessor {
 		}
 	}
 
-	private void createDatabaseConnection() {
+	private void createDatabaseConnection() throws Exception {
 		// Determine situation
 		if (configuration.hasConnectionURL() && configuration.hasCSVFiles()) {
 			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();
 				} catch (Exception ex) {
 					logger.error("Exception during database startup.", ex);
-					System.exit(-1);
+					throw ex;
+					// System.exit(-1);
 				}
 			} else {
 				// Connecting to a database
@@ -103,7 +104,7 @@ public class R2RMLProcessor {
 
 		} catch (SQLException e) {
 			logger.error("Error connecting to database.", e);
-			System.exit(-1);
+			// System.exit(-1);
 		}
 
 	}
@@ -139,13 +140,14 @@ public class R2RMLProcessor {
 		return name;
 	}
 
-	private void closeDatabaseConnection() {
+	private void closeDatabaseConnection() throws SQLException {
 		try {
 			if (!connection.isClosed())
 				connection.close();
 		} catch (SQLException e) {
 			logger.error("Error closing connection with database.", e);
-			System.exit(-1);
+			throw e;
+			// System.exit(-1);
 		}
 
 	}