jaxp/src/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
author joehw
Wed, 08 Jan 2014 10:49:54 -0800
changeset 23954 1161e065d446
parent 18890 25bdeca3173b
permissions -rw-r--r--
8029282: Enhance CharInfo set up Reviewed-by: alanb, lancea, dfuchs, skoivu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     1
/*
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     2
 * reserved comment block
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     4
 */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     5
/*
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     6
 * Copyright 2002-2004 The Apache Software Foundation.
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     7
 *
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    10
 * You may obtain a copy of the License at
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    11
 *
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    12
 *     http://www.apache.org/licenses/LICENSE-2.0
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    13
 *
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    18
 * limitations under the License.
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    19
 */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    20
/*
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    21
 * $Id: SecuritySupport.java,v 1.1.2.1 2005/08/01 02:08:48 jeffsuttor Exp $
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    22
 */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    23
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    24
package com.sun.org.apache.xalan.internal.utils;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    25
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    26
import java.io.File;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    27
import java.io.FileInputStream;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    28
import java.io.FileNotFoundException;
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
    29
import java.io.IOException;
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    30
import java.io.InputStream;
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
    31
import java.net.URL;
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    32
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    33
import java.security.AccessController;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    34
import java.security.PrivilegedAction;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    35
import java.security.PrivilegedActionException;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    36
import java.security.PrivilegedExceptionAction;
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    37
import java.util.ListResourceBundle;
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    38
import java.util.Locale;
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    39
import java.util.MissingResourceException;
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    40
import java.util.ResourceBundle;
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
    41
import java.util.Properties;
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    42
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    43
/**
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    44
 * This class is duplicated for each subpackage so keep it in sync. It is
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    45
 * package private and therefore is not exposed as part of any API.
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    46
 *
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    47
 * @xerces.internal
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    48
 */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    49
public final class SecuritySupport {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    50
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    51
    private static final SecuritySupport securitySupport = new SecuritySupport();
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    52
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    53
    /**
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    54
     * Return an instance of this class.
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    55
     */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    56
    public static SecuritySupport getInstance() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    57
        return securitySupport;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    58
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    59
23954
1161e065d446 8029282: Enhance CharInfo set up
joehw
parents: 18890
diff changeset
    60
    public static ClassLoader getContextClassLoader() {
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    61
        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    62
            public Object run() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    63
                ClassLoader cl = null;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    64
                try {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    65
                    cl = Thread.currentThread().getContextClassLoader();
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    66
                } catch (SecurityException ex) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    67
                }
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    68
                return cl;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    69
            }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    70
        });
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    71
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    72
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    73
    static ClassLoader getSystemClassLoader() {
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    74
        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    75
            public Object run() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    76
                ClassLoader cl = null;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    77
                try {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    78
                    cl = ClassLoader.getSystemClassLoader();
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    79
                } catch (SecurityException ex) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    80
                }
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    81
                return cl;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    82
            }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    83
        });
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    84
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    85
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    86
    static ClassLoader getParentClassLoader(final ClassLoader cl) {
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    87
        return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    88
            public Object run() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    89
                ClassLoader parent = null;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    90
                try {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    91
                    parent = cl.getParent();
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    92
                } catch (SecurityException ex) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
    93
                }
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    94
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    95
                // eliminate loops in case of the boot
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    96
                // ClassLoader returning itself as a parent
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    97
                return (parent == cl) ? null : parent;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    98
            }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
    99
        });
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   100
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   101
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   102
    public static String getSystemProperty(final String propName) {
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   103
        return (String) AccessController.doPrivileged(new PrivilegedAction() {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   104
            public Object run() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   105
                return System.getProperty(propName);
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   106
            }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   107
        });
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   108
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   109
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   110
    public static String getSystemProperty(final String propName, final String def) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   111
        return (String) AccessController.doPrivileged(new PrivilegedAction() {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   112
            public Object run() {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   113
                return System.getProperty(propName, def);
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   114
            }
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   115
        });
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   116
    }
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   117
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   118
    static FileInputStream getFileInputStream(final File file)
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   119
            throws FileNotFoundException {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   120
        try {
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   121
            return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   122
                public Object run() throws FileNotFoundException {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   123
                    return new FileInputStream(file);
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   124
                }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   125
            });
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   126
        } catch (PrivilegedActionException e) {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   127
            throw (FileNotFoundException)e.getException();
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   128
        }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   129
    }
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   130
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   131
    /**
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   132
     * Return resource using the same classloader for the ObjectFactory by
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   133
     * default or bootclassloader when Security Manager is in place
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   134
     */
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   135
    public static InputStream getResourceAsStream(final String name) {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   136
        if (System.getSecurityManager()!=null) {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   137
            return getResourceAsStream(null, name);
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   138
        } else {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   139
            return getResourceAsStream(ObjectFactory.findClassLoader(), name);
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   140
        }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   141
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   142
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   143
    public static InputStream getResourceAsStream(final ClassLoader cl,
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   144
            final String name) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   145
        return (InputStream) AccessController.doPrivileged(new PrivilegedAction() {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   146
            public Object run() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   147
                InputStream ris;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   148
                if (cl == null) {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   149
                    ris = Object.class.getResourceAsStream("/"+name);
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   150
                } else {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   151
                    ris = cl.getResourceAsStream(name);
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   152
                }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   153
                return ris;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   154
            }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   155
        });
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   156
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   157
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   158
    /**
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   159
     * Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   160
     * @param bundle the base name of the resource bundle, a fully qualified class name
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   161
     * @return a resource bundle for the given base name and the default locale
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   162
     */
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   163
    public static ListResourceBundle getResourceBundle(String bundle) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   164
        return getResourceBundle(bundle, Locale.getDefault());
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   165
    }
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   166
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   167
    /**
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   168
     * Gets a resource bundle using the specified base name and locale, and the caller's class loader.
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   169
     * @param bundle the base name of the resource bundle, a fully qualified class name
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   170
     * @param locale the locale for which a resource bundle is desired
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   171
     * @return a resource bundle for the given base name and locale
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   172
     */
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   173
    public static ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   174
        return AccessController.doPrivileged(new PrivilegedAction<ListResourceBundle>() {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   175
            public ListResourceBundle run() {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   176
                try {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   177
                    return (ListResourceBundle)ResourceBundle.getBundle(bundle, locale);
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   178
                } catch (MissingResourceException e) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   179
                    try {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   180
                        return (ListResourceBundle)ResourceBundle.getBundle(bundle, new Locale("en", "US"));
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   181
                    } catch (MissingResourceException e2) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   182
                        throw new MissingResourceException(
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   183
                                "Could not load any resource bundle by " + bundle, bundle, "");
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   184
                    }
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   185
                }
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   186
            }
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   187
        });
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   188
    }
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   189
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   190
    public static boolean getFileExists(final File f) {
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   191
        return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   192
                    public Object run() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   193
                        return f.exists() ? Boolean.TRUE : Boolean.FALSE;
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   194
                    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   195
                })).booleanValue();
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   196
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   197
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   198
    static long getLastModified(final File f) {
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   199
        return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   200
                    public Object run() {
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   201
                        return new Long(f.lastModified());
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   202
                    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   203
                })).longValue();
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   204
    }
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   205
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   206
    /**
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   207
     * Strip off path from an URI
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   208
     *
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   209
     * @param uri an URI with full path
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   210
     * @return the file name only
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   211
     */
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   212
    public static String sanitizePath(String uri) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   213
        if (uri == null) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   214
            return "";
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   215
        }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   216
        int i = uri.lastIndexOf("/");
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   217
        if (i > 0) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   218
            return uri.substring(i+1, uri.length());
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   219
        }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   220
        return "";
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   221
    }
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   222
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   223
    /**
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   224
     * Check the protocol used in the systemId against allowed protocols
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   225
     *
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   226
     * @param systemId the Id of the URI
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   227
     * @param allowedProtocols a list of allowed protocols separated by comma
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   228
     * @param accessAny keyword to indicate allowing any protocol
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   229
     * @return the name of the protocol if rejected, null otherwise
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   230
     */
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   231
    public static String checkAccess(String systemId, String allowedProtocols, String accessAny) throws IOException {
18890
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   232
        if (systemId == null || (allowedProtocols != null &&
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   233
                allowedProtocols.equalsIgnoreCase(accessAny))) {
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   234
            return null;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   235
        }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   236
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   237
        String protocol;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   238
        if (systemId.indexOf(":")==-1) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   239
            protocol = "file";
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   240
        } else {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   241
            URL url = new URL(systemId);
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   242
            protocol = url.getProtocol();
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   243
            if (protocol.equalsIgnoreCase("jar")) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   244
                String path = url.getPath();
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   245
                protocol = path.substring(0, path.indexOf(":"));
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   246
            }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   247
        }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   248
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   249
        if (isProtocolAllowed(protocol, allowedProtocols)) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   250
            //access allowed
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   251
            return null;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   252
        } else {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   253
            return protocol;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   254
        }
16953
a44e04deb948 6657673: Issues with JAXP
joehw
parents: 12458
diff changeset
   255
    }
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   256
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   257
    /**
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   258
     * Check if the protocol is in the allowed list of protocols. The check
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   259
     * is case-insensitive while ignoring whitespaces.
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   260
     *
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   261
     * @param protocol a protocol
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   262
     * @param allowedProtocols a list of allowed protocols
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   263
     * @return true if the protocol is in the list
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   264
     */
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   265
    private static boolean isProtocolAllowed(String protocol, String allowedProtocols) {
18890
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   266
         if (allowedProtocols == null) {
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   267
             return false;
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   268
         }
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   269
         String temp[] = allowedProtocols.split(",");
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   270
         for (String t : temp) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   271
             t = t.trim();
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   272
             if (t.equalsIgnoreCase(protocol)) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   273
                 return true;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   274
             }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   275
         }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   276
         return false;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   277
     }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   278
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   279
    /**
18890
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   280
     * Read JAXP system property in this order: system property,
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   281
     * $java.home/lib/jaxp.properties if the system property is not specified
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   282
     *
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   283
     * @param propertyId the Id of the property
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   284
     * @return the value of the property
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   285
     */
18890
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   286
    public static String getJAXPSystemProperty(String sysPropertyId) {
25bdeca3173b 8016648: FEATURE_SECURE_PROCESSING set to true or false causes SAXParseException to be thrown
joehw
parents: 17534
diff changeset
   287
        String accessExternal = getSystemProperty(sysPropertyId);
17534
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   288
        if (accessExternal == null) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   289
            accessExternal = readJAXPProperty(sysPropertyId);
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   290
        }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   291
        return accessExternal;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   292
    }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   293
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   294
    /**
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   295
     * Read from $java.home/lib/jaxp.properties for the specified property
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   296
     * The program
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   297
     *
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   298
     * @param propertyId the Id of the property
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   299
     * @return the value of the property
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   300
     */
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   301
    static String readJAXPProperty(String propertyId) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   302
        String value = null;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   303
        InputStream is = null;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   304
        try {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   305
            if (firstTime) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   306
                synchronized (cacheProps) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   307
                    if (firstTime) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   308
                        String configFile = getSystemProperty("java.home") + File.separator +
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   309
                            "lib" + File.separator + "jaxp.properties";
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   310
                        File f = new File(configFile);
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   311
                        if (getFileExists(f)) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   312
                            is = getFileInputStream(f);
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   313
                            cacheProps.load(is);
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   314
                        }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   315
                        firstTime = false;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   316
                    }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   317
                }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   318
            }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   319
            value = cacheProps.getProperty(propertyId);
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   320
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   321
        }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   322
        catch (Exception ex) {}
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   323
        finally {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   324
            if (is != null) {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   325
                try {
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   326
                    is.close();
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   327
                } catch (IOException ex) {}
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   328
            }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   329
        }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   330
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   331
        return value;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   332
    }
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   333
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   334
    /**
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   335
     * Cache for properties in java.home/lib/jaxp.properties
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   336
     */
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   337
    static final Properties cacheProps = new Properties();
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   338
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   339
    /**
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   340
     * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   341
     */
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   342
    static volatile boolean firstTime = true;
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   343
21dc0b2762da 8011653: Upgrade JDK8 to JAXP 1.5
joehw
parents: 16953
diff changeset
   344
    private SecuritySupport () {}
12458
d601e4bba306 7160380: Sync JDK8 with JAXP 1.4.5
joehw
parents:
diff changeset
   345
}