jdk/test/java/lang/reflect/Module/WithSecurityManager.java
author alanb
Thu, 26 May 2016 10:56:58 +0100
changeset 38571 75eeea87c73d
child 42338 a60f280f803c
permissions -rw-r--r--
8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer Reviewed-by: chegar, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38571
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     1
/*
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     4
 *
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     8
 *
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    13
 * accompanied this code).
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    14
 *
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    18
 *
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    21
 * questions.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    22
 */
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    23
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    24
/**
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    25
 * @test
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    26
 * @modules java.logging
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    27
 * @summary Test java.lang.reflect.Module methods that specify permission checks
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    28
 * @run main/othervm -Djava.security.policy=${test.src}/allow.policy WithSecurityManager allow
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    29
 * @run main/othervm WithSecurityManager deny
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    30
 */
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    31
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    32
import java.io.IOException;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    33
import java.io.InputStream;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    34
import java.lang.module.Configuration;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    35
import java.lang.module.ModuleFinder;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    36
import java.lang.module.ModuleReference;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    37
import java.lang.reflect.Layer;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    38
import java.lang.reflect.Module;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    39
import java.util.Collections;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    40
import java.util.Optional;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    41
import java.util.Set;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    42
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    43
/**
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    44
 * Test java.lang.reflect.Module methods that specify permission checks.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    45
 */
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    46
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    47
public class WithSecurityManager {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    48
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    49
    // a module that will be loaded into a child layer
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    50
    static final String ANOTHER_MODULE          = "java.logging";
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    51
    static final String ANOTHER_MODULE_RESOURCE = "java/util/logging/Logger.class";
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    52
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    53
    public static void main(String[] args) throws IOException {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    54
        boolean allow = args[0].equals("allow");
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    55
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    56
        // base module, in the boot layer
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    57
        Module base = Object.class.getModule();
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    58
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    59
        // another module, in a child layer
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    60
        Module other = loadModuleInChildLayer(ANOTHER_MODULE);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    61
        assertTrue(other.getLayer() != Layer.boot());
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    62
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    63
        System.setSecurityManager(new SecurityManager());
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    64
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    65
        test(base, "java/lang/Object.class", allow);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    66
        test(other, ANOTHER_MODULE_RESOURCE, allow);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    67
    }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    68
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    69
    /**
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    70
     * Test the permission checks by invoking methods on the given module.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    71
     *
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    72
     * If {@code allow} is {@code true} then the permission checks should succeed.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    73
     */
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    74
    static void test(Module m, String name, boolean allow) throws IOException {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    75
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    76
        // test Module::getClassLoader
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    77
        System.out.format("Test getClassLoader on %s ...%n", m);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    78
        try {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    79
            ClassLoader cl = m.getClassLoader();
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    80
            System.out.println(cl);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    81
            if (!allow)
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    82
                assertTrue("getClassLoader should have failed", false);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    83
        } catch (SecurityException e) {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    84
            System.out.println(e + " thrown");
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    85
            if (allow)
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    86
                throw e;
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    87
        }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    88
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    89
        // test Module::getResourceAsStream
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    90
        System.out.format("Test getResourceAsStream(\"%s\") on %s ...%n", name, m);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    91
        try (InputStream in = m.getResourceAsStream(name)) {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    92
            System.out.println(in);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    93
            if (allow && (in == null))
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    94
                assertTrue(name + " not found", false);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    95
            if (!allow && (in != null))
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    96
                assertTrue(name + " should not be found", false);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    97
        }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    98
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
    99
    }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   100
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   101
    /**
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   102
     * Create a module layer that contains the given system module.
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   103
     */
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   104
    static Module loadModuleInChildLayer(String mn) {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   105
        Optional<ModuleReference> omref = ModuleFinder.ofSystem().find(mn);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   106
        assertTrue("module " + mn + " not a system module", omref.isPresent());
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   107
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   108
        // create a ModuleFinder that only finds this module
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   109
        ModuleReference mref = omref.get();
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   110
        ModuleFinder finder = new ModuleFinder() {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   111
            @Override
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   112
            public Optional<ModuleReference> find(String name) {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   113
                if (name.equals(mn))
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   114
                    return Optional.of(mref);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   115
                else
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   116
                    return Optional.empty();
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   117
            }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   118
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   119
            @Override
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   120
            public Set<ModuleReference> findAll() {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   121
                return Collections.singleton(mref);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   122
            }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   123
        };
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   124
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   125
        // create a child configuration and layer with this module
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   126
        Layer bootLayer = Layer.boot();
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   127
        Configuration cf = bootLayer
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   128
            .configuration()
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   129
            .resolveRequires(finder, ModuleFinder.of(), Set.of(ANOTHER_MODULE));
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   130
        Layer layer = bootLayer.defineModulesWithOneLoader(cf, null);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   131
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   132
        Optional<Module> om = layer.findModule(mn);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   133
        assertTrue("module " + mn + " not in child layer", om.isPresent());
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   134
        return om.get();
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   135
    }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   136
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   137
    static void assertTrue(String msg, boolean e) {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   138
        if (!e)
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   139
            throw new RuntimeException(msg);
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   140
    }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   141
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   142
    static void assertTrue(boolean e) {
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   143
        if (!e)
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   144
            throw new RuntimeException();
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   145
    }
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   146
75eeea87c73d 8156143: Module.getResourceAsStream throws unspecified SecurityException with module in custom Layer
alanb
parents:
diff changeset
   147
}