5361N/A/*
5361N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
5361N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5361N/A *
5361N/A * This code is free software; you can redistribute it and/or modify it
5361N/A * under the terms of the GNU General Public License version 2 only, as
5361N/A * published by the Free Software Foundation.
5361N/A *
5361N/A * This code is distributed in the hope that it will be useful, but WITHOUT
5361N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5361N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5361N/A * version 2 for more details (a copy is included in the LICENSE file that
5361N/A * accompanied this code).
5361N/A *
5361N/A * You should have received a copy of the GNU General Public License version
5361N/A * 2 along with this work; if not, write to the Free Software Foundation,
5361N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5361N/A *
5361N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5361N/A * or visit www.oracle.com if you need additional information or have any
5361N/A * questions.
5361N/A */
5361N/A
5361N/Aimport java.security.Provider;
5361N/Aimport java.security.Security;
5361N/A
5361N/Apublic class Providers {
5361N/A public static void setAt(Provider p, int pos) throws Exception {
5361N/A if (Security.getProvider(p.getName()) != null) {
5361N/A Security.removeProvider(p.getName());
5361N/A }
5361N/A if (Security.insertProviderAt(p, pos) == -1) {
5361N/A throw new Exception("cannot setAt");
5361N/A }
5361N/A }
5361N/A}