com.sun.org.apache.xalan.internal.utils.SecuritySupport Java Examples
The following examples show how to use
com.sun.org.apache.xalan.internal.utils.SecuritySupport.
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 |
/** * 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: TemplatesImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Overrides the default readObject implementation since we decided * it would be cleaner not to serialize the entire tranformer * factory. [ ref bugzilla 12317 ] * We need to check if the user defined class for URIResolver also * implemented Serializable * if yes then we need to deserialize the URIResolver * Fix for bugzilla bug 22438 */ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { SecurityManager security = System.getSecurityManager(); if (security != null){ String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET); if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) { ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR); throw new UnsupportedOperationException(err.toString()); } } is.defaultReadObject(); if (is.readBoolean()) { _uriResolver = (URIResolver) is.readObject(); } _tfactory = new TransformerFactoryImpl(); }
Example #3
Source File: Encodings.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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 #4
Source File: Encodings.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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: TreeWalker.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Constructor. * @param contentHandler The implemention of the * @param systemId System identifier for the document. * contentHandler operation (toXMLString, digest, ...) */ public TreeWalker(ContentHandler contentHandler, DOMHelper dh, String systemId) { this.m_contentHandler = contentHandler; m_contentHandler.setDocumentLocator(m_locator); if (systemId != null) m_locator.setSystemId(systemId); else { try { // Bug see Bugzilla 26741 m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se) {// user.dir not accessible from applet } } m_dh = dh; }
Example #7
Source File: Encodings.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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 #8
Source File: FuncSystemProperty.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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 #9
Source File: FuncSystemProperty.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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 #10
Source File: FuncSystemProperty.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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 #11
Source File: Encodings.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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 #12
Source File: FuncSystemProperty.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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 #13
Source File: FuncSystemProperty.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * 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: FuncSystemProperty.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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 #15
Source File: Encodings.java From hottub with GNU General Public License v2.0 | 6 votes |
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 #16
Source File: XMLMessages.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. */ public static final String createXMLMessage(String msgKey, Object args[]) { if (XMLBundle == null) { XMLBundle = SecuritySupport.getResourceBundle(XML_ERROR_RESOURCES); } if (XMLBundle != null) { return createMsg(XMLBundle, msgKey, args); } else return "Could not load any resource bundles."; }
Example #17
Source File: XSLMessages.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Creates a message from the specified key and replacement arguments, * localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text in the message * created. * * @return The formatted message string. */ public static String createMessage(String msgKey, Object args[]) //throws Exception { if (XSLTBundle == null) { XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); } if (XSLTBundle != null) { return createMsg(XSLTBundle, msgKey, args); } else { return "Could not load any resource bundles."; } }
Example #18
Source File: XSLMessages.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Creates a message from the specified key and replacement arguments, * localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text in the message * created. * * @return The formatted warning string. */ public static String createWarning(String msgKey, Object args[]) //throws Exception { if (XSLTBundle == null) { XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); } if (XSLTBundle != null) { return createMsg(XSLTBundle, msgKey, args); } else { return "Could not load any resource bundles."; } }
Example #19
Source File: XSLTC.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Set the destination directory for the translet. * The current working directory will be used by default. */ public boolean setDestDirectory(String dstDirName) { final File dir = new File(dstDirName); if (SecuritySupport.getFileExists(dir) || dir.mkdirs()) { _destDir = dir; return true; } else { _destDir = null; return false; } }
Example #20
Source File: TemplatesImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Overrides the default readObject implementation since we decided * it would be cleaner not to serialize the entire tranformer * factory. [ ref bugzilla 12317 ] * We need to check if the user defined class for URIResolver also * implemented Serializable * if yes then we need to deserialize the URIResolver * Fix for bugzilla bug 22438 */ @SuppressWarnings("unchecked") private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { SecurityManager security = System.getSecurityManager(); if (security != null){ String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET); if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) { ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR); throw new UnsupportedOperationException(err.toString()); } } // We have to read serialized fields first. ObjectInputStream.GetField gf = is.readFields(); _name = (String)gf.get("_name", null); _bytecodes = (byte[][])gf.get("_bytecodes", null); _class = (Class[])gf.get("_class", null); _transletIndex = gf.get("_transletIndex", -1); _outputProperties = (Properties)gf.get("_outputProperties", null); _indentNumber = gf.get("_indentNumber", 0); if (is.readBoolean()) { _uriResolver = (URIResolver) is.readObject(); } _tfactory = new TransformerFactoryImpl(); }
Example #21
Source File: XalanConstants.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static boolean isJavaVersionAtLeast(int compareTo) { String javaVersion = SecuritySupport.getSystemProperty("java.version"); String versions[] = javaVersion.split("\\.", 3); if (Integer.parseInt(versions[0]) >= compareTo || Integer.parseInt(versions[1]) >= compareTo) { return true; } return false; }
Example #22
Source File: TreeWalker.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Constructor. * @param contentHandler The implemention of the * contentHandler operation (toXMLString, digest, ...) */ public TreeWalker(ContentHandler contentHandler) { this.m_contentHandler = contentHandler; if (m_contentHandler != null) m_contentHandler.setDocumentLocator(m_locator); try { // Bug see Bugzilla 26741 m_locator.setSystemId(SecuritySupport.getSystemProperty("user.dir") + File.separator + "dummy.xsl"); } catch (SecurityException se){// user.dir not accessible from applet } m_dh = new DOM2Helper(); }
Example #23
Source File: XSLMessages.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Creates a message from the specified key and replacement arguments, * localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text in the message * created. * * @return The formatted warning string. */ public static String createWarning(String msgKey, Object args[]) //throws Exception { if (XSLTBundle == null) { XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); } if (XSLTBundle != null) { return createMsg(XSLTBundle, msgKey, args); } else { return "Could not load any resource bundles."; } }
Example #24
Source File: XSLMessages.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Creates a message from the specified key and replacement arguments, * localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text in the message * created. * * @return The formatted message string. */ public static String createMessage(String msgKey, Object args[]) //throws Exception { if (XSLTBundle == null) { XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); } if (XSLTBundle != null) { return createMsg(XSLTBundle, msgKey, args); } else { return "Could not load any resource bundles."; } }
Example #25
Source File: XMLMessages.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. */ public static final String createXMLMessage(String msgKey, Object args[]) { if (XMLBundle == null) { XMLBundle = SecuritySupport.getResourceBundle(XML_ERROR_RESOURCES); } if (XMLBundle != null) { return createMsg(XMLBundle, msgKey, args); } else return "Could not load any resource bundles."; }
Example #26
Source File: XMLMessages.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. */ public static final String createXMLMessage(String msgKey, Object args[]) { if (XMLBundle == null) { XMLBundle = SecuritySupport.getResourceBundle(XML_ERROR_RESOURCES); } if (XMLBundle != null) { return createMsg(XMLBundle, msgKey, args); } else return "Could not load any resource bundles."; }
Example #27
Source File: Messages.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Creates a message from the specified key and replacement * arguments, localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text * in the message created. * * @return The formatted message string. * @xsl.usage internal */ public final String createMessage(String msgKey, Object args[]) { if (m_resourceBundle == null) m_resourceBundle = SecuritySupport.getResourceBundle(m_resourceBundleName); if (m_resourceBundle != null) { return createMsg(m_resourceBundle, msgKey, args); } else return "Could not load the resource bundles: "+ m_resourceBundleName; }
Example #28
Source File: XSLMessages.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Creates a message from the specified key and replacement arguments, * localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text in the message * created. * * @return The formatted message string. */ public static String createMessage(String msgKey, Object args[]) //throws Exception { if (XSLTBundle == null) { XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); } if (XSLTBundle != null) { return createMsg(XSLTBundle, msgKey, args); } else { return "Could not load any resource bundles."; } }
Example #29
Source File: TemplatesImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Overrides the default readObject implementation since we decided * it would be cleaner not to serialize the entire tranformer * factory. [ ref bugzilla 12317 ] * We need to check if the user defined class for URIResolver also * implemented Serializable * if yes then we need to deserialize the URIResolver * Fix for bugzilla bug 22438 */ @SuppressWarnings("unchecked") private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { SecurityManager security = System.getSecurityManager(); if (security != null){ String temp = SecuritySupport.getSystemProperty(DESERIALIZE_TRANSLET); if (temp == null || !(temp.length()==0 || temp.equalsIgnoreCase("true"))) { ErrorMsg err = new ErrorMsg(ErrorMsg.DESERIALIZE_TRANSLET_ERR); throw new UnsupportedOperationException(err.toString()); } } // We have to read serialized fields first. ObjectInputStream.GetField gf = is.readFields(); _name = (String)gf.get("_name", null); _bytecodes = (byte[][])gf.get("_bytecodes", null); _class = (Class[])gf.get("_class", null); _transletIndex = gf.get("_transletIndex", -1); _outputProperties = (Properties)gf.get("_outputProperties", null); _indentNumber = gf.get("_indentNumber", 0); if (is.readBoolean()) { _uriResolver = (URIResolver) is.readObject(); } _tfactory = new TransformerFactoryImpl(); }
Example #30
Source File: XSLMessages.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Creates a message from the specified key and replacement arguments, * localized to the given locale. * * @param msgKey The key for the message text. * @param args The arguments to be used as replacement text in the message * created. * * @return The formatted message string. */ public static String createMessage(String msgKey, Object args[]) //throws Exception { if (XSLTBundle == null) { XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); } if (XSLTBundle != null) { return createMsg(XSLTBundle, msgKey, args); } else { return "Could not load any resource bundles."; } }