diff src/main/java/org/monetdb/util/CmdLineOpts.java @ 493:74e390fd739c

Improve processing .monetdb file settings for JdbcClient program. When an option is not recognised it no longer aborts the startup of JdbcClient program but it is now ignored with an info message to the user.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Wed, 25 Aug 2021 22:11:04 +0200 (2021-08-25)
parents 171144a26ba0
children 6aa38e8c0f2d
line wrap: on
line diff
--- a/src/main/java/org/monetdb/util/CmdLineOpts.java
+++ b/src/main/java/org/monetdb/util/CmdLineOpts.java
@@ -85,13 +85,15 @@ public final class CmdLineOpts {
 			for (java.util.Enumeration<?> e = prop.propertyNames(); e.hasMoreElements(); ) {
 				key = (String) e.nextElement();
 				option = opts.get(key);
-				if (option == null)
-					throw new OptionsException("Unknown option: " + key);
-				option.resetArguments();
-				option.addArgument(prop.getProperty(key));
+				if (option != null) {
+					option.resetArguments();
+					option.addArgument(prop.getProperty(key));
+				} else
+					// ignore unknown options (it used to throw an OptionsException)
+					System.out.println("Info: Ignoring unknown/unsupported option (in " + file.getAbsolutePath() + "): " + key);
 			}
 		} catch (java.io.IOException e) {
-			// well... then forget about it
+			throw new OptionsException("File IO Exception: " + e);
 		}
 	}