5867N/A/*
5867N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
5867N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5867N/A *
5867N/A * This code is free software; you can redistribute it and/or modify it
5867N/A * under the terms of the GNU General Public License version 2 only, as
5867N/A * published by the Free Software Foundation.
5867N/A *
5867N/A * This code is distributed in the hope that it will be useful, but WITHOUT
5867N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5867N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5867N/A * version 2 for more details (a copy is included in the LICENSE file that
5867N/A * accompanied this code).
5867N/A *
5867N/A * You should have received a copy of the GNU General Public License version
5867N/A * 2 along with this work; if not, write to the Free Software Foundation,
5867N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5867N/A *
5867N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5867N/A * or visit www.oracle.com if you need additional information or have any
5867N/A * questions.
5867N/A */
5867N/A
5867N/A/*
5867N/A * @test
5867N/A * @bug 8005460
5867N/A * @summary [findbugs] Probably returned array should be cloned
5867N/A */
5867N/A
5867N/Aimport sun.security.krb5.PrincipalName;
5867N/A
5867N/Apublic class Immutable {
5867N/A public static void main(String[] args) throws Exception {
5867N/A PrincipalName pn1 = new PrincipalName("host/service@REALM");
5867N/A PrincipalName pn2 = (PrincipalName)pn1.clone();
5867N/A pn1.getNameStrings()[0] = "http";
5867N/A if (!pn1.equals(pn2)) {
5867N/A throw new Exception();
5867N/A }
5867N/A }
5867N/A}