本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg类的典型用法代码示例。如果您正苦于以下问题:Java ErrorMsg类的具体用法?Java ErrorMsg怎么用?Java ErrorMsg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorMsg类属于com.sun.org.apache.xalan.internal.xsltc.compiler.util包,在下文中一共展示了ErrorMsg类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: error
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Receive notification of a recoverable error.
* The transformer must continue to provide normal parsing events after
* invoking this method. It should still be possible for the application
* to process the document through to the end.
*
* @param e The warning information encapsulated in a transformer
* exception.
* @throws TransformerException if the application chooses to discontinue
* the transformation (always does in our case).
*/
@Override
public void error(TransformerException e)
throws TransformerException
{
Throwable wrapped = e.getException();
if (wrapped != null) {
System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
e.getMessageAndLocation(),
wrapped.getMessage()));
} else {
System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG,
e.getMessageAndLocation()));
}
throw e;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:TransformerFactoryImpl.java
示例2: fatalError
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Receive notification of a non-recoverable error.
* The application must assume that the transformation cannot continue
* after the Transformer has invoked this method, and should continue
* (if at all) only to collect addition error messages. In fact,
* Transformers are free to stop reporting events once this method has
* been invoked.
*
* @param e warning information encapsulated in a transformer
* exception.
* @throws TransformerException if the application chooses to discontinue
* the transformation (always does in our case).
*/
@Override
public void fatalError(TransformerException e)
throws TransformerException
{
Throwable wrapped = e.getException();
if (wrapped != null) {
System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
e.getMessageAndLocation(),
wrapped.getMessage()));
} else {
System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
e.getMessageAndLocation()));
}
throw e;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:TransformerFactoryImpl.java
示例3: loadSource
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* This method implements XSLTC's SourceLoader interface. It is used to
* glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
*
* @param href The URI of the document to load
* @param context The URI of the currently loaded document
* @param xsltc The compiler that resuests the document
* @return An InputSource with the loaded document
*/
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
try {
if (_uriResolver != null) {
final Source source = _uriResolver.resolve(href, context);
if (source != null) {
return Util.getInputSource(xsltc, source);
}
}
}
catch (TransformerException e) {
// should catch it when the resolver explicitly throws the exception
final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
xsltc.getParser().reportError(Constants.FATAL, msg);
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:TransformerFactoryImpl.java
示例4: 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
*/
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();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:TemplatesImpl.java
示例5: fatalError
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Receive notification of a non-recoverable error.
* The application must assume that the transformation cannot continue
* after the Transformer has invoked this method, and should continue
* (if at all) only to collect addition error messages. In fact,
* Transformers are free to stop reporting events once this method has
* been invoked.
*
* @param e The warning information encapsulated in a transformer
* exception.
* @throws TransformerException if the application chooses to discontinue
* the transformation (always does in our case).
*/
@Override
public void fatalError(TransformerException e)
throws TransformerException
{
Throwable wrapped = e.getException();
if (wrapped != null) {
System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
e.getMessageAndLocation(),
wrapped.getMessage()));
} else {
System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
e.getMessageAndLocation()));
}
throw e;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:TransformerImpl.java
示例6: parseContents
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Parse the contents of this <xsltc:output> element. The only attribute
* we recognise is the 'file' attribute that contains teh output filename.
*/
public void parseContents(Parser parser) {
// Get the output filename from the 'file' attribute
String filename = getAttribute("file");
// If the 'append' attribute is set to "yes" or "true",
// the output is appended to the file.
String append = getAttribute("append");
// Verify that the filename is in fact set
if ((filename == null) || (filename.equals(EMPTYSTRING))) {
reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "file");
}
// Save filename as an attribute value template
_filename = AttributeValue.create(this, filename, parser);
if (append != null && (append.toLowerCase().equals("yes") ||
append.toLowerCase().equals("true"))) {
_append = true;
}
else
_append = false;
parseChildren(parser);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:TransletOutput.java
示例7: parseContents
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Parse the name of the <xsl:decimal-formatting/> element
*/
public void parseContents(Parser parser) {
// Get the name of these decimal formatting symbols
final String name = getAttribute("name");
if (name.length() > 0) {
if (!XML11Char.isXML11ValidQName(name)){
ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this);
parser.reportError(Constants.ERROR, err);
}
}
_name = parser.getQNameIgnoreDefaultNs(name);
if (_name == null) {
_name = parser.getQNameIgnoreDefaultNs(EMPTYSTRING);
}
// Check if a set of symbols has already been registered under this name
SymbolTable stable = parser.getSymbolTable();
if (stable.getDecimalFormatting(_name) != null) {
reportWarning(this, parser, ErrorMsg.SYMBOLS_REDEF_ERR,
_name.toString());
}
else {
stable.addDecimalFormatting(_name, this);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:DecimalFormatting.java
示例8: createAST
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Instanciates a SAX2 parser and generate the AST from the input.
*/
public void createAST(Stylesheet stylesheet) {
try {
if (stylesheet != null) {
stylesheet.parseContents(this);
final Iterator<SyntaxTreeNode> elements = stylesheet.elements();
while (elements.hasNext()) {
SyntaxTreeNode child = elements.next();
if (child instanceof Text) {
final int l = getLineNumber();
ErrorMsg err =
new ErrorMsg(ErrorMsg.ILLEGAL_TEXT_NODE_ERR,l,null);
reportError(ERROR, err);
}
}
if (!errorsFound()) {
stylesheet.typeCheck(_symbolTable);
}
}
}
catch (TypeCheckError e) {
reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:Parser.java
示例9: typeCheck
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Type check the two parameters for this function
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
// Check that the function was passed exactly two arguments
if (argumentCount() != 2) {
throw new TypeCheckError(ErrorMsg.ILLEGAL_ARG_ERR, getName(), this);
}
// The first argument must be a String, or cast to a String
_base = argument(0);
Type baseType = _base.typeCheck(stable);
if (baseType != Type.String)
_base = new CastExpr(_base, Type.String);
// The second argument must also be a String, or cast to a String
_token = argument(1);
Type tokenType = _token.typeCheck(stable);
if (tokenType != Type.String)
_token = new CastExpr(_token, Type.String);
return _type = Type.Boolean;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ContainsCall.java
示例10: parseContents
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* The contents of a <xsl:with-param> elements are either in the element's
* 'select' attribute (this has precedence) or in the element body.
*/
public void parseContents(Parser parser) {
final String name = getAttribute("name");
if (name.length() > 0) {
if (!XML11Char.isXML11ValidQName(name)) {
ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name,
this);
parser.reportError(Constants.ERROR, err);
}
setName(parser.getQNameIgnoreDefaultNs(name));
}
else {
reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name");
}
final String select = getAttribute("select");
if (select.length() > 0) {
_select = parser.parseExpression(this, "select", null);
}
parseChildren(parser);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:WithParam.java
示例11: parseContents
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
public void parseContents(Parser parser) {
final String select = getAttribute("select");
final String mode = getAttribute("mode");
if (select.length() > 0) {
_select = parser.parseExpression(this, "select", null);
}
if (mode.length() > 0) {
if (!XML11Char.isXML11ValidQName(mode)) {
ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, mode, this);
parser.reportError(Constants.ERROR, err);
}
_modeName = parser.getQNameIgnoreDefaultNs(mode);
}
// instantiate Mode if needed, cache (apply temp) function name
_functionName =
parser.getTopLevelStylesheet().getMode(_modeName).functionName();
parseChildren(parser);// with-params
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:ApplyTemplates.java
示例12: createAST
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Instanciates a SAX2 parser and generate the AST from the input.
*/
public void createAST(Stylesheet stylesheet) {
try {
if (stylesheet != null) {
stylesheet.parseContents(this);
final int precedence = stylesheet.getImportPrecedence();
final Enumeration elements = stylesheet.elements();
while (elements.hasMoreElements()) {
Object child = elements.nextElement();
if (child instanceof Text) {
final int l = getLineNumber();
ErrorMsg err =
new ErrorMsg(ErrorMsg.ILLEGAL_TEXT_NODE_ERR,l,null);
reportError(ERROR, err);
}
}
if (!errorsFound()) {
stylesheet.typeCheck(_symbolTable);
}
}
}
catch (TypeCheckError e) {
reportError(ERROR, new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR, e));
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:Parser.java
示例13: parseContents
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
public void parseContents(Parser parser) {
final String name = getAttribute("name");
if (name.length() > 0) {
_isLiteral = Util.isLiteral(name);
if (_isLiteral) {
if (!XML11Char.isXML11ValidNCName(name)) {
ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_NCNAME_ERR, name, this);
parser.reportError(Constants.ERROR, err);
}
}
_name = AttributeValue.create(this, name, parser);
}
else
reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name");
if (name.equals("xml")) {
reportError(this, parser, ErrorMsg.ILLEGAL_PI_ERR, "xml");
}
parseChildren(parser);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ProcessingInstruction.java
示例14: typeCheck
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Type checking a cast expression amounts to verifying that the
* type conversion is legal. Cast expressions are created during
* type checking, but typeCheck() is usually not called on them.
* As a result, this method is called from the constructor.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
Type tleft = _left.getType();
if (tleft == null) {
tleft = _left.typeCheck(stable);
}
if (tleft instanceof NodeType) {
tleft = Type.Node; // multiple instances
}
else if (tleft instanceof ResultTreeType) {
tleft = Type.ResultTree; // multiple instances
}
if (InternalTypeMap.maps(tleft, _type) != null) {
return _type;
}
// throw new TypeCheckError(this);
throw new TypeCheckError(new ErrorMsg(
ErrorMsg.DATA_CONVERSION_ERR, tleft.toString(), _type.toString()));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:CastExpr.java
示例15: passWarningsToListener
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Pass warning messages from the compiler to the error listener
*/
private void passWarningsToListener(ArrayList<ErrorMsg> messages)
throws TransformerException
{
if (_errorListener == null || messages == null) {
return;
}
// Pass messages to listener, one by one
final int count = messages.size();
for (int pos = 0; pos < count; pos++) {
ErrorMsg msg = messages.get(pos);
// Workaround for the TCK failure ErrorListener.errorTests.error001.
if (msg.isWarningError())
_errorListener.error(
new TransformerConfigurationException(msg.toString()));
else
_errorListener.warning(
new TransformerConfigurationException(msg.toString()));
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:TransformerFactoryImpl.java
示例16: passErrorsToListener
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* Pass error messages from the compiler to the error listener
*/
private void passErrorsToListener(ArrayList<ErrorMsg> messages) {
try {
if (_errorListener == null || messages == null) {
return;
}
// Pass messages to listener, one by one
final int count = messages.size();
for (int pos = 0; pos < count; pos++) {
String message = messages.get(pos).toString();
_errorListener.error(new TransformerException(message));
}
}
catch (TransformerException e) {
// nada
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TransformerFactoryImpl.java
示例17: 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);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:TransformerImpl.java
示例18: parseContents
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
/**
* The contents of a <xsl:with-param> elements are either in the element's
* 'select' attribute (this has precedence) or in the element body.
*/
public void parseContents(Parser parser) {
final String name = getAttribute("name");
if (name.length() > 0) {
if (!XML11Char.isXML11ValidQName(name)) {
ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name,
this);
parser.reportError(Constants.ERROR, err);
}
setName(parser.getQNameIgnoreDefaultNs(name));
} else {
reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name");
}
final String select = getAttribute("select");
if (select.length() > 0) {
_select = parser.parseExpression(this, "select", null);
}
parseChildren(parser);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:WithParam.java
示例19: getQName
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; //导入依赖的package包/类
private QName getQName(final String stringRep, boolean reportError,
boolean ignoreDefaultNs)
{
// parse and retrieve namespace
final int colon = stringRep.lastIndexOf(':');
if (colon != -1) {
final String prefix = stringRep.substring(0, colon);
final String localname = stringRep.substring(colon + 1);
String namespace = null;
// Get the namespace uri from the symbol table
if (prefix.equals(XMLNS_PREFIX) == false) {
namespace = _symbolTable.lookupNamespace(prefix);
if (namespace == null && reportError) {
final int line = getLineNumber();
ErrorMsg err = new ErrorMsg(ErrorMsg.NAMESPACE_UNDEF_ERR,
line, prefix);
reportError(ERROR, err);
}
}
return getQName(namespace, prefix, localname);
}
else {
if (stringRep.equals(XMLNS_PREFIX)) {
ignoreDefaultNs = true;
}
final String defURI = ignoreDefaultNs ? null
: _symbolTable.lookupNamespace(EMPTYSTRING);
return getQName(defURI, null, stringRep);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:Parser.java
示例20: 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;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:SmartTransformerFactoryImpl.java
注:本文中的com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论