/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @author Charlie Lai
* @bug 4394746
* @summary Resources should not be loaded until necessar
* @run main/othervm/policy=Format.policy -Djava.security.auth.login.config=file:${test.src}/Format.config Format
*
*/
public class Format
{
try {
("test", "write");
throw new SecurityException("test 1 failed");
} catch (IllegalArgumentException iae) {
// good
}
try {
("Format", "read");
throw new SecurityException("test 2 failed");
} catch (IllegalArgumentException iae) {
// good
}
try {
("Format Format", "read");
throw new SecurityException("test 3 failed");
} catch (IllegalArgumentException iae) {
// good
}
try {
("Format Format Format", "read");
throw new SecurityException("test 4 failed");
} catch (IllegalArgumentException iae) {
// good
}
try {
("Format Format \"Format", "read");
throw new SecurityException("test 5 failed");
} catch (IllegalArgumentException iae) {
// good
}
try {
("Format * \"Format\"", "read");
throw new SecurityException("test 6 failed");
} catch (IllegalArgumentException iae) {
// good
}
try {
throw new SecurityException("test 7 failed");
} catch (NullPointerException npe) {
// good
}
try {
throw new SecurityException("test 8 failed");
} catch (NullPointerException npe) {
// good
}
try {
throw new SecurityException("test 9 failed");
} catch (NullPointerException npe) {
// good
}
try {
throw new SecurityException("test 10 failed");
} catch (NullPointerException npe) {
// good
}
try {
s.getPrincipals(null);
throw new SecurityException("test 11 failed");
} catch (NullPointerException npe) {
// good
}
try {
("cn=test1"));
} catch (Exception e) {
throw new SecurityException("test 12 failed: e.toString()");
}
try {
("cn=test1"));
s.setReadOnly();
i.next();
i.remove();
throw new SecurityException("test 13 failed");
} catch (IllegalStateException ise) {
// good
}
try {
throw new SecurityException("test 14 failed");
} catch (SecurityException se) {
// good
}
try {
throw new SecurityException("test 15 failed");
} catch (SecurityException se) {
// good
}
try {
throw new SecurityException("test 16 failed");
} catch (LoginException le) {
// good
}
try {
throw new SecurityException("test 17 failed");
} catch (LoginException le) {
// good
}
try {
throw new SecurityException("test 18 failed");
} catch (LoginException le) {
// good
}
try {
throw new SecurityException("test 19 failed");
} catch (LoginException le) {
// good
}
try {
throw new SecurityException("test 20 failed");
} catch (LoginException le) {
// good
}
try {
throw new SecurityException("test 21 failed");
} catch (LoginException le) {
// good
}
/*** TESTS FOR THE COM PACKAGE RESOURCES ***/
try {
throw new SecurityException("test 22 failed");
} catch (NullPointerException e) {
// good
}
try {
} catch (Exception e) {
throw new SecurityException("test 23 failed");
}
try {
} catch (Exception e) {
throw new SecurityException("test 24 failed");
}
try {
throw new SecurityException("test 25 failed");
} catch (IllegalArgumentException e) {
// good
}
try {
} catch (Exception e) {
throw new SecurityException("test 26 failed");
}
try {
} catch (Exception e) {
throw new SecurityException("test 27 failed");
}
try {
} catch (Exception e) {
throw new SecurityException("test 28 failed");
}
try {
new NTSidPrimaryGroupPrincipal("test");
} catch (Exception e) {
throw new SecurityException("test 29 failed");
}
try {
} catch (Exception e) {
throw new SecurityException("test 30 failed");
}
try {
} catch (Exception e) {
throw new SecurityException("test 31 failed");
}
try {
true);
} catch (Exception e) {
throw new SecurityException("test 32 failed");
}
try {
false);
} catch (Exception e) {
throw new SecurityException("test 33 failed");
}
try {
} catch (Exception e) {
throw new SecurityException("test 34 failed");
}
try {
} catch (Exception e) {
throw new SecurityException("test 35 failed");
}
}
}