158 };
159
160 /**
161 * Create a new ProviderList from an array of configs
162 */
163 private ProviderList(ProviderConfig[] configs, boolean allLoaded) {
164 this.configs = configs;
165 this.allLoaded = allLoaded;
166 }
167
168 /**
169 * Return a new ProviderList parsed from the java.security Properties.
170 */
171 private ProviderList() {
172 List<ProviderConfig> configList = new ArrayList<>();
173 String entry;
174 int i = 1;
175
176 while ((entry = Security.getProperty("security.provider." + i)) != null) {
177 entry = entry.trim();
178 if (entry.length() == 0) {
179 System.err.println("invalid entry for " +
180 "security.provider." + i);
181 break;
182 }
183 int k = entry.indexOf(' ');
184 ProviderConfig config;
185 if (k == -1) {
186 config = new ProviderConfig(entry);
187 } else {
188 String provName = entry.substring(0, k);
189 String argument = entry.substring(k + 1).trim();
190 config = new ProviderConfig(provName, argument);
191 }
192
193 // Get rid of duplicate providers.
194 if (configList.contains(config) == false) {
195 configList.add(config);
196 }
197 i++;
198 }
199 configs = configList.toArray(PC0);
200
201 // Load config entries for use when getInstance is called
202 entry = Security.getProperty("jdk.security.provider.preferred");
203 if (entry != null && (entry = entry.trim()).length() > 0) {
204 String[] entries = entry.split(",");
205 if (ProviderList.preferredPropList == null) {
206 ProviderList.preferredPropList = new PreferredList();
207 }
208
209 for (String e : entries) {
210 i = e.indexOf(':');
211 if (i < 0) {
212 if (debug != null) {
213 debug.println("invalid preferred entry skipped. " +
214 "Missing colon delimiter \"" + e + "\"");
215 }
216 continue;
217 }
218 ProviderList.preferredPropList.add(new PreferredEntry(
219 e.substring(0, i).trim(), e.substring(i + 1).trim()));
220 }
221 }
222
223 if (debug != null) {
|
158 };
159
160 /**
161 * Create a new ProviderList from an array of configs
162 */
163 private ProviderList(ProviderConfig[] configs, boolean allLoaded) {
164 this.configs = configs;
165 this.allLoaded = allLoaded;
166 }
167
168 /**
169 * Return a new ProviderList parsed from the java.security Properties.
170 */
171 private ProviderList() {
172 List<ProviderConfig> configList = new ArrayList<>();
173 String entry;
174 int i = 1;
175
176 while ((entry = Security.getProperty("security.provider." + i)) != null) {
177 entry = entry.trim();
178 if (entry.isEmpty()) {
179 System.err.println("invalid entry for " +
180 "security.provider." + i);
181 break;
182 }
183 int k = entry.indexOf(' ');
184 ProviderConfig config;
185 if (k == -1) {
186 config = new ProviderConfig(entry);
187 } else {
188 String provName = entry.substring(0, k);
189 String argument = entry.substring(k + 1).trim();
190 config = new ProviderConfig(provName, argument);
191 }
192
193 // Get rid of duplicate providers.
194 if (configList.contains(config) == false) {
195 configList.add(config);
196 }
197 i++;
198 }
199 configs = configList.toArray(PC0);
200
201 // Load config entries for use when getInstance is called
202 entry = Security.getProperty("jdk.security.provider.preferred");
203 if (entry != null && !(entry = entry.trim()).isEmpty()) {
204 String[] entries = entry.split(",");
205 if (ProviderList.preferredPropList == null) {
206 ProviderList.preferredPropList = new PreferredList();
207 }
208
209 for (String e : entries) {
210 i = e.indexOf(':');
211 if (i < 0) {
212 if (debug != null) {
213 debug.println("invalid preferred entry skipped. " +
214 "Missing colon delimiter \"" + e + "\"");
215 }
216 continue;
217 }
218 ProviderList.preferredPropList.add(new PreferredEntry(
219 e.substring(0, i).trim(), e.substring(i + 1).trim()));
220 }
221 }
222
223 if (debug != null) {
|