jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java
author chegar
Wed, 03 Dec 2014 14:22:58 +0000
changeset 27565 729f9700483a
parent 26037 508779ce6619
child 29922 7b9c1e1532cf
permissions -rw-r--r--
8049367: Modular Run-Time Images Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, bradford.wetmore@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, james.laskey@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com, sundararajan.athijegannathan@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
26030
576ffa819e23 8054372: Cleanup of com.sun.media.sound packages
serb
parents: 23889
diff changeset
     2
 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3453
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3453
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3453
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3453
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3453
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.media.sound;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.BufferedInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.io.FileInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.ArrayList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.Iterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.util.Properties;
11123
399112af8803 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers
chegar
parents: 5506
diff changeset
    37
import java.util.ServiceLoader;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.security.PrivilegedAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import javax.sound.sampled.AudioPermission;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/** Managing security in the Java Sound implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * This class contains all code that uses and is used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * SecurityManager.doPrivileged().
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * @author Matthias Pfisterer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
18215
b2afd66ce6db 8006328: Improve robustness of sound classes
serb
parents: 11123
diff changeset
    50
final class JSSecurityManager {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /** Prevent instantiation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private JSSecurityManager() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /** Checks if the VM currently has a SecurityManager installed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * Note that this may change over time. So the result of this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * should not be cached.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * @return true if a SecurityManger is installed, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private static boolean hasSecurityManager() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        return (System.getSecurityManager() != null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    static void checkRecordPermission() throws SecurityException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        if(Printer.trace) Printer.trace("JSSecurityManager.checkRecordPermission()");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        SecurityManager sm = System.getSecurityManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        if (sm != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
            sm.checkPermission(new AudioPermission("record"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /** Load properties from a file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        This method tries to load properties from the filename give into
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        the passed properties object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        If the file cannot be found or something else goes wrong,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        the method silently fails.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        @param properties The properties bundle to store the values of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        properties file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        @param filename The filename of the properties file to load. This
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 26037
diff changeset
    84
        filename is interpreted as relative to the subdirectory "conf" in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        the JRE directory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    static void loadProperties(final Properties properties,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                               final String filename) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        if(hasSecurityManager()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                // invoke the privileged action using 1.2 security
11123
399112af8803 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers
chegar
parents: 5506
diff changeset
    92
                PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
399112af8803 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers
chegar
parents: 5506
diff changeset
    93
                        public Void run() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                            loadPropertiesImpl(properties, filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                AccessController.doPrivileged(action);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                if(Printer.debug)Printer.debug("Loaded properties with JDK 1.2 security");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                if(Printer.debug)Printer.debug("Exception loading properties with JDK 1.2 security");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                // try without using JDK 1.2 security
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                loadPropertiesImpl(properties, filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            // not JDK 1.2 security, assume we already have permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            loadPropertiesImpl(properties, filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    private static void loadPropertiesImpl(Properties properties,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                                           String filename) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        if(Printer.trace)Printer.trace(">> JSSecurityManager: loadPropertiesImpl()");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        String fname = System.getProperty("java.home");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            if (fname == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                throw new Error("Can't find java.home ??");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            }
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 26037
diff changeset
   120
            File f = new File(fname, "conf");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            f = new File(f, filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            fname = f.getCanonicalPath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            InputStream in = new FileInputStream(fname);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            BufferedInputStream bin = new BufferedInputStream(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                properties.load(bin);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                if (in != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                    in.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        } catch (Throwable t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            if (Printer.trace) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                System.err.println("Could not load properties file \"" + fname + "\"");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                t.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        if(Printer.trace)Printer.trace("<< JSSecurityManager: loadPropertiesImpl() completed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
18215
b2afd66ce6db 8006328: Improve robustness of sound classes
serb
parents: 11123
diff changeset
   141
    /** Create a Thread in the current ThreadGroup.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    static Thread createThread(final Runnable runnable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                               final String threadName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                               final boolean isDaemon, final int priority,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                               final boolean doStart) {
18215
b2afd66ce6db 8006328: Improve robustness of sound classes
serb
parents: 11123
diff changeset
   147
        Thread thread = new Thread(runnable);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        if (threadName != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            thread.setName(threadName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        thread.setDaemon(isDaemon);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        if (priority >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            thread.setPriority(priority);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        if (doStart) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            thread.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        return thread;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 20468
diff changeset
   161
    static synchronized <T> List<T> getProviders(final Class<T> providerClass) {
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 20468
diff changeset
   162
        List<T> p = new ArrayList<>(7);
20468
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   163
        // ServiceLoader creates "lazy" iterator instance, but it ensures that
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   164
        // next/hasNext run with permissions that are restricted by whatever
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   165
        // creates the ServiceLoader instance, so it requires to be called from
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   166
        // privileged section
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   167
        final PrivilegedAction<Iterator<T>> psAction =
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   168
                new PrivilegedAction<Iterator<T>>() {
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   169
                    @Override
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   170
                    public Iterator<T> run() {
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   171
                        return ServiceLoader.load(providerClass).iterator();
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   172
                    }
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   173
                };
4424783ed2ce 8022119: test api/javax_sound/sampled/spi/MixerProvider/indexTGF_MixerProviderTests fails
serb
parents: 18215
diff changeset
   174
        final Iterator<T> ps = AccessController.doPrivileged(psAction);
3453
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   175
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   176
        // the iterator's hasNext() method looks through classpath for
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   177
        // the provider class names, so it requires read permissions
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   178
        PrivilegedAction<Boolean> hasNextAction = new PrivilegedAction<Boolean>() {
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   179
            public Boolean run() {
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   180
                return ps.hasNext();
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   181
            }
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   182
        };
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   183
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   184
        while (AccessController.doPrivileged(hasNextAction)) {
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   185
            try {
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   186
                // the iterator's next() method creates instances of the
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   187
                // providers and it should be called in the current security
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   188
                // context
11123
399112af8803 7116946: JSSecurityManager should use java.util.ServiceLoader to lookup service providers
chegar
parents: 5506
diff changeset
   189
                T provider = ps.next();
3453
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   190
                if (providerClass.isInstance(provider)) {
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   191
                    // $$mp 2003-08-22
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   192
                    // Always adding at the beginning reverses the
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   193
                    // order of the providers. So we no longer have
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   194
                    // to do this in AudioSystem and MidiSystem.
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   195
                    p.add(0, provider);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                }
3453
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   197
            } catch (Throwable t) {
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   198
                //$$fb 2002-11-07: do not fail on SPI not found
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   199
                if (Printer.err) t.printStackTrace();
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   200
            }
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   201
        }
55b3a9c935cd 6777448: JDK13Services.getProviders creates instances with full privileges [hawtin, alexp]
amenkov
parents: 2
diff changeset
   202
        return p;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
}