本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg.toString方法的典型用法代码示例。如果您正苦于以下问题:Java ErrorMsg.toString方法的具体用法?Java ErrorMsg.toString怎么用?Java ErrorMsg.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg
的用法示例。
在下文中一共展示了ErrorMsg.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setParameter
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* Implements JAXP's Transformer.setParameter()
* Add a parameter for the transformation. The parameter is simply passed
* on to the translet - no validation is performed - so any unused
* parameters are quitely ignored by the translet.
*
* @param name The name of the parameter
* @param value The value to assign to the parameter
*/
@Override
public void setParameter(String name, Object value) {
if (value == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, name);
throw new IllegalArgumentException(err.toString());
}
if (_isIdentity) {
if (_parameters == null) {
_parameters = new HashMap<>();
}
_parameters.put(name, value);
}
else {
_translet.addParameter(name, value);
}
}
示例2: setErrorListener
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* javax.xml.transform.sax.TransformerFactory implementation.
* Set the error event listener for the TransformerFactory, which is used
* for the processing of transformation instructions, and not for the
* transformation itself.
*
* @param listener The error listener to use with the TransformerFactory
* @throws IllegalArgumentException
*/
@Override
public void setErrorListener(ErrorListener listener)
throws IllegalArgumentException
{
if (listener == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
"TransformerFactory");
throw new IllegalArgumentException(err.toString());
}
_errorListener = listener;
}
示例3: makeStylesheet
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* Create an instance of the <code>Stylesheet</code> class,
* and then parse, typecheck and compile the instance.
* Must be called after <code>parse()</code>.
*/
public Stylesheet makeStylesheet(SyntaxTreeNode element)
throws CompilerException {
try {
Stylesheet stylesheet;
if (element instanceof Stylesheet) {
stylesheet = (Stylesheet)element;
}
else {
stylesheet = new Stylesheet();
stylesheet.setSimplified();
stylesheet.addElement(element);
stylesheet.setAttributes((AttributesImpl) element.getAttributes());
// Map the default NS if not already defined
if (element.lookupNamespace(EMPTYSTRING) == null) {
element.addPrefixMapping(EMPTYSTRING, EMPTYSTRING);
}
}
stylesheet.setParser(this);
return stylesheet;
}
catch (ClassCastException e) {
ErrorMsg err = new ErrorMsg(ErrorMsg.NOT_STYLESHEET_ERR, element);
throw new CompilerException(err.toString());
}
}
示例4: getFeature
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* javax.xml.transform.sax.TransformerFactory implementation.
* Look up the value of a feature (to see if it is supported).
* This method must be updated as the various methods and features of this
* class are implemented.
*
* @param name The feature name
* @return 'true' if feature is supported, 'false' if not
*/
public boolean getFeature(String name) {
// All supported features should be listed here
String[] features = {
DOMSource.FEATURE,
DOMResult.FEATURE,
SAXSource.FEATURE,
SAXResult.FEATURE,
StreamSource.FEATURE,
StreamResult.FEATURE
};
// feature name cannot be null
if (name == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
throw new NullPointerException(err.toString());
}
// Inefficient, but it really does not matter in a function like this
for (int i = 0; i < features.length; i++) {
if (name.equals(features[i]))
return true;
}
// secure processing?
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
return featureSecureProcessing;
}
// unknown feature
return false;
}
示例5: setErrorListener
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* Implements JAXP's Transformer.setErrorListener()
* Set the error event listener in effect for the transformation.
* Register a message handler in the translet in order to forward
* xsl:messages to error listener.
*
* @param listener The error event listener to use
* @throws IllegalArgumentException
*/
@Override
public void setErrorListener(ErrorListener listener)
throws IllegalArgumentException {
if (listener == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
"Transformer");
throw new IllegalArgumentException(err.toString());
}
_errorListener = listener;
// Register a message handler to report xsl:messages
if (_translet != null)
_translet.setMessageHandler(new MessageHandler(_errorListener));
}
示例6: getOutputProperty
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* Implements JAXP's Transformer.getOutputProperty().
* Get an output property that is in effect for the transformation. The
* property specified may be a property that was set with setOutputProperty,
* or it may be a property specified in the stylesheet.
*
* @param name A non-null string that contains the name of the property
* @throws IllegalArgumentException if the property name is not known
*/
@Override
public String getOutputProperty(String name)
throws IllegalArgumentException
{
if (!validOutputProperty(name)) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
throw new IllegalArgumentException(err.toString());
}
return _properties.getProperty(name);
}
示例7: setOutputProperties
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* Implements JAXP's Transformer.setOutputProperties().
* Set the output properties for the transformation. These properties
* will override properties set in the Templates with xsl:output.
* Unrecognised properties will be quitely ignored.
*
* @param properties The properties to use for the Transformer
* @throws IllegalArgumentException Never, errors are ignored
*/
@Override
public void setOutputProperties(Properties properties)
throws IllegalArgumentException
{
if (properties != null) {
final Enumeration names = properties.propertyNames();
while (names.hasMoreElements()) {
final String name = (String) names.nextElement();
// Ignore lower layer properties
if (isDefaultProperty(name, properties)) continue;
if (validOutputProperty(name)) {
_properties.setProperty(name, properties.getProperty(name));
}
else {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
throw new IllegalArgumentException(err.toString());
}
}
}
else {
_properties = _propertiesClone;
}
}
示例8: setOutputProperty
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* Implements JAXP's Transformer.setOutputProperty().
* Get an output property that is in effect for the transformation. The
* property specified may be a property that was set with
* setOutputProperty(), or it may be a property specified in the stylesheet.
*
* @param name The name of the property to set
* @param value The value to assign to the property
* @throws IllegalArgumentException Never, errors are ignored
*/
@Override
public void setOutputProperty(String name, String value)
throws IllegalArgumentException
{
if (!validOutputProperty(name)) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
throw new IllegalArgumentException(err.toString());
}
_properties.setProperty(name, value);
}
示例9: readObject
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* 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();
}
示例10: getTransletInstance
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* This method generates an instance of the translet class that is
* wrapped inside this Template. The translet instance will later
* be wrapped inside a Transformer object.
*/
private Translet getTransletInstance()
throws TransformerConfigurationException {
try {
if (_name == null) return null;
if (_class == null) defineTransletClasses();
// The translet needs to keep a reference to all its auxiliary
// class to prevent the GC from collecting them
AbstractTranslet translet = (AbstractTranslet)
_class[_transletIndex].getConstructor().newInstance();
translet.postInitialization();
translet.setTemplates(this);
translet.setServicesMechnism(_useServicesMechanism);
translet.setAllowedProtocols(_accessExternalStylesheet);
if (_auxClasses != null) {
translet.setAuxiliaryClasses(_auxClasses);
}
return translet;
}
catch (InstantiationException | IllegalAccessException |
NoSuchMethodException | InvocationTargetException e) {
ErrorMsg err = new ErrorMsg(ErrorMsg.TRANSLET_OBJECT_ERR, _name);
throw new TransformerConfigurationException(err.toString(), e);
}
}
示例11: getFeature
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* javax.xml.transform.sax.TransformerFactory implementation.
* Look up the value of a feature (to see if it is supported).
* This method must be updated as the various methods and features of this
* class are implemented.
*
* @param name The feature name
* @return 'true' if feature is supported, 'false' if not
*/
@Override
public boolean getFeature(String name) {
// All supported features should be listed here
String[] features = {
DOMSource.FEATURE,
DOMResult.FEATURE,
SAXSource.FEATURE,
SAXResult.FEATURE,
StAXSource.FEATURE,
StAXResult.FEATURE,
StreamSource.FEATURE,
StreamResult.FEATURE,
SAXTransformerFactory.FEATURE,
SAXTransformerFactory.FEATURE_XMLFILTER,
XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
};
// feature name cannot be null
if (name == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
throw new NullPointerException(err.toString());
}
// Inefficient, but array is small
for (int i =0; i < features.length; i++) {
if (name.equals(features[i])) {
return true;
}
}
// secure processing?
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
return !_isNotSecureProcessing;
}
/** Check to see if the property is managed by the security manager **/
String propertyValue = (_featureManager != null) ?
_featureManager.getValueAsString(name) : null;
if (propertyValue != null) {
return Boolean.parseBoolean(propertyValue);
}
// Feature not supported
return false;
}
示例12: getSignature
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* Compute the JVM signature for the class.
*/
static final String getSignature(Class clazz) {
if (clazz.isArray()) {
final StringBuffer sb = new StringBuffer();
Class cl = clazz;
while (cl.isArray()) {
sb.append("[");
cl = cl.getComponentType();
}
sb.append(getSignature(cl));
return sb.toString();
}
else if (clazz.isPrimitive()) {
if (clazz == Integer.TYPE) {
return "I";
}
else if (clazz == Byte.TYPE) {
return "B";
}
else if (clazz == Long.TYPE) {
return "J";
}
else if (clazz == Float.TYPE) {
return "F";
}
else if (clazz == Double.TYPE) {
return "D";
}
else if (clazz == Short.TYPE) {
return "S";
}
else if (clazz == Character.TYPE) {
return "C";
}
else if (clazz == Boolean.TYPE) {
return "Z";
}
else if (clazz == Void.TYPE) {
return "V";
}
else {
final String name = clazz.toString();
ErrorMsg err = new ErrorMsg(ErrorMsg.UNKNOWN_SIG_TYPE_ERR,name);
throw new Error(err.toString());
}
}
else {
return "L" + clazz.getName().replace('.', '/') + ';';
}
}
示例13: startElement
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* SAX2: Receive notification of the beginning of an element.
* The parser may re-use the attribute list that we're passed so
* we clone the attributes in our own Attributes implementation
*/
public void startElement(String uri, String localname,
String qname, Attributes attributes)
throws SAXException {
final int col = qname.lastIndexOf(':');
final String prefix = (col == -1) ? null : qname.substring(0, col);
SyntaxTreeNode element = makeInstance(uri, prefix,
localname, attributes);
if (element == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.ELEMENT_PARSE_ERR,
prefix+':'+localname);
throw new SAXException(err.toString());
}
// If this is the root element of the XML document we need to make sure
// that it contains a definition of the XSL namespace URI
if (_root == null) {
if ((_prefixMapping == null) ||
(_prefixMapping.containsValue(Constants.XSLT_URI) == false))
_rootNamespaceDef = false;
else
_rootNamespaceDef = true;
_root = element;
}
else {
SyntaxTreeNode parent = (SyntaxTreeNode)_parentStack.peek();
parent.addElement(element);
element.setParent(parent);
}
element.setAttributes(new AttributesImpl(attributes));
element.setPrefixMapping(_prefixMapping);
if (element instanceof Stylesheet) {
// Extension elements and excluded elements have to be
// handled at this point in order to correctly generate
// Fallback elements from <xsl:fallback>s.
getSymbolTable().setCurrentNode(element);
((Stylesheet)element).declareExtensionPrefixes(this);
}
_prefixMapping = null;
_parentStack.push(element);
}
示例14: getAttribute
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* javax.xml.transform.sax.TransformerFactory implementation.
* Returns the value set for a TransformerFactory attribute
*
* @param name The attribute name
* @return An object representing the attribute value
* @throws IllegalArgumentException
*/
@Override
public Object getAttribute(String name)
throws IllegalArgumentException
{
// Return value for attribute 'translet-name'
if (name.equals(TRANSLET_NAME)) {
return _transletName;
}
else if (name.equals(GENERATE_TRANSLET)) {
return _generateTranslet;
}
else if (name.equals(AUTO_TRANSLET)) {
return _autoTranslet;
}
else if (name.equals(ENABLE_INLINING)) {
if (_enableInlining)
return Boolean.TRUE;
else
return Boolean.FALSE;
} else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
return _xmlSecurityManager;
} else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
return _extensionClassLoader;
} else if (JdkXmlUtils.CATALOG_FILES.equals(name)) {
return _catalogFiles;
} else if (JdkXmlUtils.CATALOG_DEFER.equals(name)) {
return _catalogDefer;
} else if (JdkXmlUtils.CATALOG_PREFER.equals(name)) {
return _catalogPrefer;
} else if (JdkXmlUtils.CATALOG_RESOLVE.equals(name)) {
return _catalogResolve;
} else if (JdkXmlFeatures.CATALOG_FEATURES.equals(name)) {
return buildCatalogFeatures();
} else if (JdkXmlUtils.CDATA_CHUNK_SIZE.equals(name)) {
return _cdataChunkSize;
}
/** Check to see if the property is managed by the security manager **/
String propertyValue = (_xmlSecurityManager != null) ?
_xmlSecurityManager.getLimitAsString(name) : null;
if (propertyValue != null) {
return propertyValue;
} else {
propertyValue = (_xmlSecurityPropertyMgr != null) ?
_xmlSecurityPropertyMgr.getValue(name) : null;
if (propertyValue != null) {
return propertyValue;
}
}
// Throw an exception for all other attributes
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
throw new IllegalArgumentException(err.toString());
}
示例15: getFeature
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入方法依赖的package包/类
/**
* javax.xml.transform.sax.TransformerFactory implementation.
* Look up the value of a feature (to see if it is supported).
* This method must be updated as the various methods and features of this
* class are implemented.
*
* @param name The feature name
* @return 'true' if feature is supported, 'false' if not
*/
@Override
public boolean getFeature(String name) {
// All supported features should be listed here
String[] features = {
DOMSource.FEATURE,
DOMResult.FEATURE,
SAXSource.FEATURE,
SAXResult.FEATURE,
StAXSource.FEATURE,
StAXResult.FEATURE,
StreamSource.FEATURE,
StreamResult.FEATURE,
SAXTransformerFactory.FEATURE,
SAXTransformerFactory.FEATURE_XMLFILTER,
XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
};
// feature name cannot be null
if (name == null) {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
throw new NullPointerException(err.toString());
}
// Inefficient, but array is small
for (int i =0; i < features.length; i++) {
if (name.equals(features[i])) {
return true;
}
}
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
return !_isNotSecureProcessing;
}
/** Check to see if the property is managed by the JdkXmlFeatues **/
int index = _xmlFeatures.getIndex(name);
if (index > -1) {
return _xmlFeatures.getFeature(index);
}
// Feature not supported
return false;
}