jdk/src/share/classes/com/sun/media/sound/JDK13Services.java
author serb
Thu, 07 Aug 2014 17:02:48 +0400
changeset 26030 576ffa819e23
parent 24548 9c007a986347
permissions -rw-r--r--
8054372: Cleanup of com.sun.media.sound packages Reviewed-by: azvegint, prr
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: 24548
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: 3452
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: 3452
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: 3452
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3452
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3452
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
26030
576ffa819e23 8054372: Cleanup of com.sun.media.sound packages
serb
parents: 24548
diff changeset
    28
import java.security.AccessController;
576ffa819e23 8054372: Cleanup of com.sun.media.sound packages
serb
parents: 24548
diff changeset
    29
import java.security.PrivilegedAction;
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    30
import java.util.ArrayList;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.Collections;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.Properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
3452
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    35
import javax.sound.midi.Receiver;
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    36
import javax.sound.midi.Sequencer;
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    37
import javax.sound.midi.Synthesizer;
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    38
import javax.sound.midi.Transmitter;
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    39
import javax.sound.midi.spi.MidiDeviceProvider;
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    40
import javax.sound.midi.spi.MidiFileReader;
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    41
import javax.sound.midi.spi.MidiFileWriter;
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    42
import javax.sound.midi.spi.SoundbankReader;
3452
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    43
import javax.sound.sampled.Clip;
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    44
import javax.sound.sampled.Port;
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    45
import javax.sound.sampled.SourceDataLine;
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    46
import javax.sound.sampled.TargetDataLine;
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    47
import javax.sound.sampled.spi.AudioFileReader;
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    48
import javax.sound.sampled.spi.AudioFileWriter;
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    49
import javax.sound.sampled.spi.FormatConversionProvider;
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    50
import javax.sound.sampled.spi.MixerProvider;
3452
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
    51
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
/**
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    54
 * JDK13Services uses the Service class in JDK 1.3 to discover a list of service
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    55
 * providers installed in the system.
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    56
 * <p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * This class is public because it is called from javax.sound.midi.MidiSystem
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * and javax.sound.sampled.AudioSystem. The alternative would be to make
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * JSSecurityManager public, which is considered worse.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * @author Matthias Pfisterer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 */
18215
b2afd66ce6db 8006328: Improve robustness of sound classes
serb
parents: 5506
diff changeset
    63
public final class JDK13Services {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    65
    /**
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    66
     * Filename of the properties file for default provider properties. This
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    67
     * file is searched in the subdirectory "lib" of the JRE directory (this
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    68
     * behaviour is hardcoded).
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    69
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    private static final String PROPERTIES_FILENAME = "sound.properties";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    72
    /**
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    73
     * Properties loaded from the properties file for default provider
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    74
     * properties.
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    75
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    private static Properties properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    78
    /**
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    79
     * Private, no-args constructor to ensure against instantiation.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    private JDK13Services() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    84
    /**
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    85
     * Obtains a List containing installed instances of the providers for the
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    86
     * requested service. The returned List is immutable.
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    87
     *
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    88
     * @param serviceClass The type of providers requested. This should be one
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    89
     *                     of AudioFileReader.class, AudioFileWriter.class,
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    90
     *                     FormatConversionProvider.class, MixerProvider.class,
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    91
     *                     MidiDeviceProvider.class, MidiFileReader.class,
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    92
     *                     MidiFileWriter.class or SoundbankReader.class.
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    93
     *
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    94
     * @return A List of providers of the requested type. This List is
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    95
     *         immutable.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     */
23889
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    97
    public static List<?> getProviders(final Class<?> serviceClass) {
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    98
        final List<?> providers;
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
    99
        if (!MixerProvider.class.equals(serviceClass)
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   100
                && !FormatConversionProvider.class.equals(serviceClass)
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   101
                && !AudioFileReader.class.equals(serviceClass)
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   102
                && !AudioFileWriter.class.equals(serviceClass)
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   103
                && !MidiDeviceProvider.class.equals(serviceClass)
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   104
                && !SoundbankReader.class.equals(serviceClass)
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   105
                && !MidiFileWriter.class.equals(serviceClass)
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   106
                && !MidiFileReader.class.equals(serviceClass)) {
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   107
            providers = new ArrayList<>(0);
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   108
        } else {
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   109
            providers = JSSecurityManager.getProviders(serviceClass);
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   110
        }
c8412b2715b5 8026163: Enhance media provisioning
serb
parents: 18215
diff changeset
   111
        return Collections.unmodifiableList(providers);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /** Obtain the provider class name part of a default provider property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        @param typeClass The type of the default provider property. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        should be one of Receiver.class, Transmitter.class, Sequencer.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        Clip.class or Port.class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        @return The value of the provider class name part of the property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        (the part before the hash sign), if available. If the property is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        not set or the value has no provider class name part, null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
24548
9c007a986347 8042256: Fix raw and unchecked lint warnings in com.sun.media.sound
darcy
parents: 23889
diff changeset
   123
    public static synchronized String getDefaultProviderClassName(Class<?> typeClass) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        String value = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        String defaultProviderSpec = getDefaultProvider(typeClass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        if (defaultProviderSpec != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            int hashpos = defaultProviderSpec.indexOf('#');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            if (hashpos == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                // instance name only; leave value as null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            } else if (hashpos > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                value = defaultProviderSpec.substring(0, hashpos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                value = defaultProviderSpec;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /** Obtain the instance name part of a default provider property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        @param typeClass The type of the default provider property. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        should be one of Receiver.class, Transmitter.class, Sequencer.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        Clip.class or Port.class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        @return The value of the instance name part of the property (the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        part after the hash sign), if available. If the property is not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        or the value has no instance name part, null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     */
24548
9c007a986347 8042256: Fix raw and unchecked lint warnings in com.sun.media.sound
darcy
parents: 23889
diff changeset
   149
    public static synchronized String getDefaultInstanceName(Class<?> typeClass) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        String value = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        String defaultProviderSpec = getDefaultProvider(typeClass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        if (defaultProviderSpec != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            int hashpos = defaultProviderSpec.indexOf('#');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            if (hashpos >= 0 && hashpos < defaultProviderSpec.length() - 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                value = defaultProviderSpec.substring(hashpos + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    /** Obtain the value of a default provider property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        @param typeClass The type of the default provider property. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        should be one of Receiver.class, Transmitter.class, Sequencer.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        Clip.class or Port.class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        @return The complete value of the property, if available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        If the property is not set, null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     */
24548
9c007a986347 8042256: Fix raw and unchecked lint warnings in com.sun.media.sound
darcy
parents: 23889
diff changeset
   170
    private static synchronized String getDefaultProvider(Class<?> typeClass) {
3452
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   171
        if (!SourceDataLine.class.equals(typeClass)
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   172
                && !TargetDataLine.class.equals(typeClass)
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   173
                && !Clip.class.equals(typeClass)
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   174
                && !Port.class.equals(typeClass)
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   175
                && !Receiver.class.equals(typeClass)
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   176
                && !Transmitter.class.equals(typeClass)
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   177
                && !Synthesizer.class.equals(typeClass)
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   178
                && !Sequencer.class.equals(typeClass)) {
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   179
            return null;
e18ac2718a06 6738524: JDK13Services allows read access to system properties from untrusted code
amenkov
parents: 2
diff changeset
   180
        }
26030
576ffa819e23 8054372: Cleanup of com.sun.media.sound packages
serb
parents: 24548
diff changeset
   181
        String name = typeClass.getName();
576ffa819e23 8054372: Cleanup of com.sun.media.sound packages
serb
parents: 24548
diff changeset
   182
        String value = AccessController.doPrivileged(
576ffa819e23 8054372: Cleanup of com.sun.media.sound packages
serb
parents: 24548
diff changeset
   183
                (PrivilegedAction<String>) () -> System.getProperty(name));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        if (value == null) {
26030
576ffa819e23 8054372: Cleanup of com.sun.media.sound packages
serb
parents: 24548
diff changeset
   185
            value = getProperties().getProperty(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        if ("".equals(value)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            value = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /** Obtain a properties bundle containing property values from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        properties file. If the properties file could not be loaded,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        the properties bundle is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    private static synchronized Properties getProperties() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        if (properties == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            properties = new Properties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            JSSecurityManager.loadProperties(properties, PROPERTIES_FILENAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        return properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
}