nullDomain.java revision 0
1929N/A/*
1929N/A * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
1929N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1929N/A *
1929N/A * This code is free software; you can redistribute it and/or modify it
1929N/A * under the terms of the GNU General Public License version 2 only, as
1929N/A * published by the Free Software Foundation.
1929N/A *
1929N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1929N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1929N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1929N/A * version 2 for more details (a copy is included in the LICENSE file that
1929N/A * accompanied this code).
1929N/A *
1929N/A * You should have received a copy of the GNU General Public License version
1929N/A * 2 along with this work; if not, write to the Free Software Foundation,
1929N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1929N/A *
1929N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1929N/A * CA 95054 USA or visit www.sun.com if you need additional information or
1929N/A * have any questions.
1929N/A */
1929N/A
1929N/A/*
1929N/A *
1929N/A *
1929N/A *
1929N/A * @test
1929N/A * @bug 4507434
2399N/A * @summary PolicyFile.getPermissions(ProtectionDomain) should return
1929N/A * empty permissions when passed in null protection domain
1929N/A *
1929N/A */
1929N/A
1929N/Aimport java.security.*;
1929N/Aimport java.util.*;
1929N/A
1929N/Apublic class nullDomain {
1929N/A public static void main(String[] args) {
1929N/A try {
1929N/A System.out.println(
1929N/A Policy.getPolicy().getPermissions((ProtectionDomain) null));
1929N/A PropertyPermission p = new PropertyPermission
1929N/A ("user.home","read");
2399N/A if (Policy.getPolicy().implies((ProtectionDomain)null, p))
1929N/A System.out.println ("implies succeeded");
1929N/A } catch (Exception e) {
1929N/A e.printStackTrace();
1929N/A throw new RuntimeException ("Unexpected exception " +
1929N/A e.toString());
1929N/A
2399N/A }
1929N/A }
1929N/A}
1929N/A