src/share/classes/sun/security/krb5/internal/crypto/EType.java
Print this page
rev 7199 : 8014310: JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679
@@ -228,23 +228,27 @@
}
/**
* Retrieves the default etypes from the configuration file, or
* if that's not available, return the built-in list of default etypes.
+ * This result is always non-empty. If no etypes are found,
+ * an exception is thrown.
*/
- // used in KrbAsReq, KeyTab
- public static int[] getDefaults(String configName) {
+ public static int[] getDefaults(String configName)
+ throws KrbException {
+ Config config = null;
try {
- return Config.getInstance().defaultEtype(configName);
+ config = Config.getInstance();
} catch (KrbException exc) {
if (DEBUG) {
System.out.println("Exception while getting " +
configName + exc.getMessage());
System.out.println("Using default builtin etypes");
}
return getBuiltInDefaults();
}
+ return config.defaultEtype(configName);
}
/**
* Retrieve the default etypes from the configuration file for
* those etypes for which there are corresponding keys.
@@ -254,14 +258,10 @@
* we have keys.
*/
public static int[] getDefaults(String configName, EncryptionKey[] keys)
throws KrbException {
int[] answer = getDefaults(configName);
- if (answer == null) {
- throw new KrbException("No supported encryption types listed in "
- + configName);
- }
List<Integer> list = new ArrayList<>(answer.length);
for (int i = 0; i < answer.length; i++) {
if (EncryptionKey.findKey(answer[i], keys) != null) {
list.add(answer[i]);