MixedBasicPermissions.java revision 2362
145e0143b4896d03ce53b1af6787afa1a7e73959dh/*
145e0143b4896d03ce53b1af6787afa1a7e73959dh * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
145e0143b4896d03ce53b1af6787afa1a7e73959dh * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
145e0143b4896d03ce53b1af6787afa1a7e73959dh *
145e0143b4896d03ce53b1af6787afa1a7e73959dh * This code is free software; you can redistribute it and/or modify it
145e0143b4896d03ce53b1af6787afa1a7e73959dh * under the terms of the GNU General Public License version 2 only, as
145e0143b4896d03ce53b1af6787afa1a7e73959dh * published by the Free Software Foundation.
145e0143b4896d03ce53b1af6787afa1a7e73959dh *
145e0143b4896d03ce53b1af6787afa1a7e73959dh * This code is distributed in the hope that it will be useful, but WITHOUT
145e0143b4896d03ce53b1af6787afa1a7e73959dh * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
145e0143b4896d03ce53b1af6787afa1a7e73959dh * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
145e0143b4896d03ce53b1af6787afa1a7e73959dh * version 2 for more details (a copy is included in the LICENSE file that
145e0143b4896d03ce53b1af6787afa1a7e73959dh * accompanied this code).
145e0143b4896d03ce53b1af6787afa1a7e73959dh *
145e0143b4896d03ce53b1af6787afa1a7e73959dh * You should have received a copy of the GNU General Public License version
145e0143b4896d03ce53b1af6787afa1a7e73959dh * 2 along with this work; if not, write to the Free Software Foundation,
145e0143b4896d03ce53b1af6787afa1a7e73959dh * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
145e0143b4896d03ce53b1af6787afa1a7e73959dh *
145e0143b4896d03ce53b1af6787afa1a7e73959dh * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
658280b6253b61dbb155f43d0e3cbcffa85ccb90David Hollister * or visit www.oracle.com if you need additional information or have any
658280b6253b61dbb155f43d0e3cbcffa85ccb90David Hollister * questions.
658280b6253b61dbb155f43d0e3cbcffa85ccb90David Hollister */
145e0143b4896d03ce53b1af6787afa1a7e73959dh
145e0143b4896d03ce53b1af6787afa1a7e73959dh/*
145e0143b4896d03ce53b1af6787afa1a7e73959dh * @test
145e0143b4896d03ce53b1af6787afa1a7e73959dh * @bug 6568872
145e0143b4896d03ce53b1af6787afa1a7e73959dh * @summary BasicPermission.newPermissionCollection() violates general contract specified in Permission class
145e0143b4896d03ce53b1af6787afa1a7e73959dh */
145e0143b4896d03ce53b1af6787afa1a7e73959dhpublic class MixedBasicPermissions {
145e0143b4896d03ce53b1af6787afa1a7e73959dh public static void main(String[] args) {
145e0143b4896d03ce53b1af6787afa1a7e73959dh try {
145e0143b4896d03ce53b1af6787afa1a7e73959dh new java.net.NetPermission("1.1.1.1", "connect").newPermissionCollection().add(new java.util.PropertyPermission("j", "read"));
145e0143b4896d03ce53b1af6787afa1a7e73959dh } catch (Exception e) {
6745c559e4b531cf336a91f4653445c32ee46693Jesse Butler return;
145e0143b4896d03ce53b1af6787afa1a7e73959dh // Correct place
601c90f161ff0319c1b4a2c3362b466043a65d8dSrikanth, Ramana }
145e0143b4896d03ce53b1af6787afa1a7e73959dh throw new RuntimeException("Should not be here");
145e0143b4896d03ce53b1af6787afa1a7e73959dh }
145e0143b4896d03ce53b1af6787afa1a7e73959dh}
145e0143b4896d03ce53b1af6787afa1a7e73959dh