本文整理汇总了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类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
}
示例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));
}
}
示例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;
}
示例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);
}
示例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
}
示例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));
}
}
示例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);
}
示例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()));
}
示例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()));
}
}