Java Code Examples for com.sun.org.apache.xalan.internal.utils.SecuritySupport#getResourceAsStream()

The following examples show how to use com.sun.org.apache.xalan.internal.utils.SecuritySupport#getResourceAsStream() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FuncSystemProperty.java    From TencentKona-8 with GNU General Public License v2.0 7 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 2
Source File: Encodings.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 3
Source File: FuncSystemProperty.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 4
Source File: Encodings.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 5
Source File: FuncSystemProperty.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 6
Source File: Encodings.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 7
Source File: FuncSystemProperty.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 8
Source File: Encodings.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 9
Source File: FuncSystemProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve a property bundle from XSLT_PROPERTIES
 *
 * @param target The target property bag the file will be placed into.
 */
private void loadPropertyFile(Properties target)
{
  try
  {
    // Use SecuritySupport class to provide privileged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(XSLT_PROPERTIES);

    // get a buffered version
    try (BufferedInputStream bis = new BufferedInputStream(is)) {
        target.load(bis);  // and load up the property bag from this
    }
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 10
Source File: Encodings.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 11
Source File: FuncSystemProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 12
Source File: Encodings.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 13
Source File: FuncSystemProperty.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 14
Source File: Encodings.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 15
Source File: FuncSystemProperty.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 16
Source File: Encodings.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 17
Source File: FuncSystemProperty.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
Example 18
Source File: Encodings.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 19
Source File: Encodings.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException {
    String urlString = null;
    InputStream is = null;

    try {
        urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, "");
    } catch (SecurityException e) {
    }

    if (urlString != null && urlString.length() > 0) {
        URL url = new URL(urlString);
        is = url.openStream();
    }

    if (is == null) {
        is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE);
    }
    return is;
}
 
Example 20
Source File: FuncSystemProperty.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}