--- old/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Config.java Mon Jun 8 21:35:14 2015 +++ new/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Config.java Mon Jun 8 21:35:14 2015 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,30 +69,6 @@ } } - // temporary storage for configurations - // needed because the SunPKCS11 needs to call the superclass constructor - // in provider before accessing any instance variables - private final static Map configMap = - new HashMap(); - - static Config getConfig(final String name, final InputStream stream) { - Config config = configMap.get(name); - if (config != null) { - return config; - } - try { - config = new Config(name, stream); - configMap.put(name, config); - return config; - } catch (Exception e) { - throw new ProviderException("Error parsing configuration", e); - } - } - - static Config removeConfig(String name) { - return configMap.remove(name); - } - private final static boolean DEBUG = false; private static void debug(Object o) { @@ -101,6 +77,9 @@ } } + // file name containing this configuration + private String filename; + // Reader and StringTokenizer used during parsing private Reader reader; @@ -201,19 +180,16 @@ // memory footprint (true). private boolean nssOptimizeSpace = false; - private Config(String filename, InputStream in) throws IOException { - if (in == null) { - if (filename.startsWith("--")) { - // inline config - String config = filename.substring(2).replace("\\n", "\n"); - reader = new StringReader(config); - } else { - in = new FileInputStream(expand(filename)); - } + Config(String fn) throws IOException { + this.filename = fn; + if (filename.startsWith("--")) { + // inline config + String config = filename.substring(2).replace("\\n", "\n"); + reader = new StringReader(config); + } else { + reader = new BufferedReader(new InputStreamReader + (new FileInputStream(expand(filename)))); } - if (reader == null) { - reader = new BufferedReader(new InputStreamReader(in)); - } parsedKeywords = new HashSet(); st = new StreamTokenizer(reader); setupTokenizer(); @@ -220,6 +196,10 @@ parse(); } + String getFileName() { + return filename; + } + String getName() { return name; }