1 /*
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
145 } while (engProps.containsKey(prop1));
146 engProps.put(prop1, val1);
147 }
148 }
149 }
150 }
151
152 // See if there is any other action to take.
153 if ("--config-file=".equals(state)) {
154 String propFile = av.remove(0);
155 Properties fileProps = new Properties();
156 try (InputStream propIn = new FileInputStream(propFile)) {
157 fileProps.load(propIn);
158 }
159 if (engProps.get(verboseProp) != null)
160 fileProps.list(System.out);
161 for (Map.Entry<Object,Object> me : fileProps.entrySet()) {
162 engProps.put((String) me.getKey(), (String) me.getValue());
163 }
164 } else if ("--version".equals(state)) {
165 System.out.println(MessageFormat.format(RESOURCE.getString(DriverResource.VERSION), Driver.class.getName(), "1.31, 07/05/05"));
166 return;
167 } else if ("--help".equals(state)) {
168 printUsage(doPack, true, System.out);
169 System.exit(1);
170 return;
171 } else {
172 break;
173 }
174 }
175 } catch (IllegalArgumentException ee) {
176 System.err.println(MessageFormat.format(RESOURCE.getString(DriverResource.BAD_ARGUMENT), ee));
177 printUsage(doPack, false, System.err);
178 System.exit(2);
179 return;
180 }
181
182 // Deal with remaining non-engine properties:
183 for (String opt : avProps.keySet()) {
184 String val = avProps.get(opt);
185 switch (opt) {
186 case "--repack":
187 doRepack = true;
188 break;
189 case "--no-gzip":
|
1 /*
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
145 } while (engProps.containsKey(prop1));
146 engProps.put(prop1, val1);
147 }
148 }
149 }
150 }
151
152 // See if there is any other action to take.
153 if ("--config-file=".equals(state)) {
154 String propFile = av.remove(0);
155 Properties fileProps = new Properties();
156 try (InputStream propIn = new FileInputStream(propFile)) {
157 fileProps.load(propIn);
158 }
159 if (engProps.get(verboseProp) != null)
160 fileProps.list(System.out);
161 for (Map.Entry<Object,Object> me : fileProps.entrySet()) {
162 engProps.put((String) me.getKey(), (String) me.getValue());
163 }
164 } else if ("--version".equals(state)) {
165 System.out.println(MessageFormat.format(RESOURCE.getString(DriverResource.VERSION),
166 Driver.class.getName(), "1.31, 07/05/05"));
167 return;
168 } else if ("--help".equals(state)) {
169 printUsage(doPack, true, System.out);
170 System.exit(0);
171 return;
172 } else {
173 break;
174 }
175 }
176 } catch (IllegalArgumentException ee) {
177 System.err.println(MessageFormat.format(RESOURCE.getString(DriverResource.BAD_ARGUMENT), ee));
178 printUsage(doPack, false, System.err);
179 System.exit(2);
180 return;
181 }
182
183 // Deal with remaining non-engine properties:
184 for (String opt : avProps.keySet()) {
185 String val = avProps.get(opt);
186 switch (opt) {
187 case "--repack":
188 doRepack = true;
189 break;
190 case "--no-gzip":
|