1 /*
2 * Copyright (c) 1999, 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
129
130 // echo the initial property settings to stdout
131 if (log.isLoggable(PlatformLogger.Level.FINE)) {
132 log.fine("DebugSettings:\n{0}", this);
133 }
134 }
135
136 public String toString() {
137 ByteArrayOutputStream bout = new ByteArrayOutputStream();
138 PrintStream pout = new PrintStream(bout);
139 for (String key : props.stringPropertyNames()) {
140 String value = props.getProperty(key, "");
141 pout.println(key + " = " + value);
142 }
143 return new String(bout.toByteArray());
144 }
145
146 /*
147 * Sets up default property values
148 */
149 private void loadDefaultProperties() {
150 // is there a more inefficient way to setup default properties?
151 // maybe, but this has got to be close to 100% non-optimal
152 try {
153 for ( int nprop = 0; nprop < DEFAULT_PROPS.length; nprop++ ) {
154 StringBufferInputStream in = new StringBufferInputStream(DEFAULT_PROPS[nprop]);
155 props.load(in);
156 in.close();
157 }
158 } catch(IOException ioe) {
159 }
160 }
161
162 /*
163 * load properties from file, overriding defaults
164 */
165 private void loadFileProperties() {
166 String propPath;
167 Properties fileProps;
168
|
1 /*
2 * Copyright (c) 1999, 2014, 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
129
130 // echo the initial property settings to stdout
131 if (log.isLoggable(PlatformLogger.Level.FINE)) {
132 log.fine("DebugSettings:\n{0}", this);
133 }
134 }
135
136 public String toString() {
137 ByteArrayOutputStream bout = new ByteArrayOutputStream();
138 PrintStream pout = new PrintStream(bout);
139 for (String key : props.stringPropertyNames()) {
140 String value = props.getProperty(key, "");
141 pout.println(key + " = " + value);
142 }
143 return new String(bout.toByteArray());
144 }
145
146 /*
147 * Sets up default property values
148 */
149 @SuppressWarnings("deprecation")
150 private void loadDefaultProperties() {
151 // is there a more inefficient way to setup default properties?
152 // maybe, but this has got to be close to 100% non-optimal
153 try {
154 for ( int nprop = 0; nprop < DEFAULT_PROPS.length; nprop++ ) {
155 StringBufferInputStream in = new StringBufferInputStream(DEFAULT_PROPS[nprop]);
156 props.load(in);
157 in.close();
158 }
159 } catch(IOException ioe) {
160 }
161 }
162
163 /*
164 * load properties from file, overriding defaults
165 */
166 private void loadFileProperties() {
167 String propPath;
168 Properties fileProps;
169
|