diff -r f0dca628176c -r b046ba510bbc src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java Tue Nov 12 10:19:04 2019 +0100 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTabEntry.java Tue Nov 12 01:36:17 2019 -0800 @@ -1,4 +1,5 @@ /* + * Copyright (c) 2000, 2019, 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 @@ -32,7 +33,8 @@ import sun.security.krb5.*; import sun.security.krb5.internal.*; -import java.io.UnsupportedEncodingException; + +import static java.nio.charset.StandardCharsets.ISO_8859_1; /** * This class represents a Key Table entry. Each entry contains the service principal of @@ -83,17 +85,10 @@ int totalPrincipalLength = 0; String[] names = service.getNameStrings(); for (int i = 0; i < names.length; i++) { - try { - totalPrincipalLength += principalSize + names[i].getBytes("8859_1").length; - } catch (UnsupportedEncodingException exc) { - } + totalPrincipalLength += principalSize + names[i].getBytes(ISO_8859_1).length; } - int realmLen = 0; - try { - realmLen = realm.toString().getBytes("8859_1").length; - } catch (UnsupportedEncodingException exc) { - } + int realmLen = realm.toString().getBytes(ISO_8859_1).length; int size = principalComponentSize + realmSize + realmLen + totalPrincipalLength + principalTypeSize