Here are the examples of the java api class com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg taken from open source projects.
1. TransformerFactoryImpl#setAttribute()
Project: openjdk
File: TransformerFactoryImpl.java
File: TransformerFactoryImpl.java
/** * javax.xml.transform.sax.TransformerFactory implementation. * Sets the value for a TransformerFactory attribute. * * @param name The attribute name * @param value An object representing the attribute value * @throws IllegalArgumentException */ @Override public void setAttribute(String name, Object value) throws IllegalArgumentException { // for translets that cannot be given a name from their system-id. if (name.equals(TRANSLET_NAME) && value instanceof String) { _transletName = (String) value; return; } else if (name.equals(DESTINATION_DIRECTORY) && value instanceof String) { _destinationDirectory = (String) value; return; } else if (name.equals(PACKAGE_NAME) && value instanceof String) { _packageName = (String) value; return; } else if (name.equals(JAR_NAME) && value instanceof String) { _jarFileName = (String) value; return; } else if (name.equals(GENERATE_TRANSLET)) { if (value instanceof Boolean) { _generateTranslet = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _generateTranslet = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(AUTO_TRANSLET)) { if (value instanceof Boolean) { _autoTranslet = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _autoTranslet = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(USE_CLASSPATH)) { if (value instanceof Boolean) { _useClasspath = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _useClasspath = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(DEBUG)) { if (value instanceof Boolean) { _debug = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _debug = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(ENABLE_INLINING)) { if (value instanceof Boolean) { _enableInlining = ((Boolean) value).booleanValue(); return; } else if (value instanceof String) { _enableInlining = ((String) value).equalsIgnoreCase("true"); return; } } else if (name.equals(INDENT_NUMBER)) { if (value instanceof String) { try { _indentNumber = Integer.parseInt((String) value); return; } catch (NumberFormatException e) { } } else if (value instanceof Integer) { _indentNumber = ((Integer) value).intValue(); return; } } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) { if (value instanceof ClassLoader) { _extensionClassLoader = (ClassLoader) value; return; } else { final ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_VALUE_ERR, "Extension Functions ClassLoader"); throw new IllegalArgumentException(err.toString()); } } if (_xmlSecurityManager != null && _xmlSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) { return; } if (_xmlSecurityPropertyMgr != null && _xmlSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) { _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(Property.ACCESS_EXTERNAL_DTD); _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(Property.ACCESS_EXTERNAL_STYLESHEET); return; } // Throw an exception for all other attributes final ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name); throw new IllegalArgumentException(err.toString()); }
2. TransformerFactoryImpl#getAttribute()
Project: openjdk
File: TransformerFactoryImpl.java
File: TransformerFactoryImpl.java
/** * 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 new Boolean(_generateTranslet); } else if (name.equals(AUTO_TRANSLET)) { return new Boolean(_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; } /** 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()); }
3. XPathParser#report_error()
Project: openjdk
File: XPathParser.java
File: XPathParser.java
public void report_error(String message, Object info) { final ErrorMsg err = new ErrorMsg(ErrorMsg.SYNTAX_ERR, _lineNumber, _expression); _parser.reportError(Constants.FATAL, err); }
4. When#translate()
Project: openjdk
File: When.java
File: When.java
/** * This method should never be called. An Otherwise object will explicitly * translate the "test" expression and and contents of this element. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ErrorMsg msg = new ErrorMsg(ErrorMsg.STRAY_WHEN_ERR, this); getParser().reportError(Constants.ERROR, msg); }
5. UnresolvedRef#reportError()
Project: openjdk
File: UnresolvedRef.java
File: UnresolvedRef.java
private ErrorMsg reportError() { ErrorMsg err = new ErrorMsg(ErrorMsg.VARIABLE_UNDEF_ERR, _variableName, this); getParser().reportError(Constants.ERROR, err); return (err); }
6. TopLevelElement#translate()
Project: openjdk
File: TopLevelElement.java
File: TopLevelElement.java
/** * Translate this node into JVM bytecodes. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg msg = new ErrorMsg(ErrorMsg.NOT_IMPLEMENTED_ERR, getClass(), this); getParser().reportError(FATAL, msg); }
7. SyntaxTreeNode#reportWarning()
Project: openjdk
File: SyntaxTreeNode.java
File: SyntaxTreeNode.java
/** * Report a recoverable error to the parser. * @param element The element in which the error occured (normally 'this' * but it could also be an expression/pattern/etc.) * @param parser The XSLT parser to report the error to. * @param error The error code (from util/ErrorMsg). * @param message Any additional error message. */ protected void reportWarning(SyntaxTreeNode element, Parser parser, String errorCode, String message) { final ErrorMsg error = new ErrorMsg(errorCode, message, element); parser.reportError(Constants.WARNING, error); }
8. SyntaxTreeNode#reportError()
Project: openjdk
File: SyntaxTreeNode.java
File: SyntaxTreeNode.java
/** * Report an error to the parser. * @param element The element in which the error occured (normally 'this' * but it could also be an expression/pattern/etc.) * @param parser The XSLT parser to report the error to. * @param error The error code (from util/ErrorMsg). * @param message Any additional error message. */ protected void reportError(SyntaxTreeNode element, Parser parser, String errorCode, String message) { final ErrorMsg error = new ErrorMsg(errorCode, message, element); parser.reportError(Constants.ERROR, error); }
9. Otherwise#translate()
Project: openjdk
File: Otherwise.java
File: Otherwise.java
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final Parser parser = getParser(); final ErrorMsg err = new ErrorMsg(ErrorMsg.STRAY_OTHERWISE_ERR, this); parser.reportError(Constants.ERROR, err); }
10. Instruction#translate()
Project: openjdk
File: Instruction.java
File: Instruction.java
/** * Translate this node into JVM bytecodes. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg msg = new ErrorMsg(ErrorMsg.NOT_IMPLEMENTED_ERR, getClass(), this); getParser().reportError(FATAL, msg); }
11. FunctionAvailableCall#typeCheck()
Project: openjdk
File: FunctionAvailableCall.java
File: FunctionAvailableCall.java
/** * Argument of function-available call must be literal, typecheck * returns the type of function-available to be boolean. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_type != null) { return _type; } if (_arg instanceof LiteralExpr) { return _type = Type.Boolean; } ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR, "function-available", this); throw new TypeCheckError(err); }
12. Expression#translate()
Project: openjdk
File: Expression.java
File: Expression.java
/** * Translate this node into JVM bytecodes. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ErrorMsg msg = new ErrorMsg(ErrorMsg.NOT_IMPLEMENTED_ERR, getClass(), this); getParser().reportError(FATAL, msg); }
13. ElementAvailableCall#typeCheck()
Project: openjdk
File: ElementAvailableCall.java
File: ElementAvailableCall.java
/** * Force the argument to this function to be a literal string. */ public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (argument() instanceof LiteralExpr) { return _type = Type.Boolean; } ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR, "element-available", this); throw new TypeCheckError(err); }
14. Choose#translate()
Project: openjdk
File: Choose.java
File: Choose.java
/** * Translate this Choose element. Generate a test-chain for the various * <xsl:when> elements and default to the <xsl:otherwise> if present. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final Vector whenElements = new Vector(); Otherwise otherwise = null; Iterator<SyntaxTreeNode> elements = elements(); // These two are for reporting errors only ErrorMsg error = null; final int line = getLineNumber(); // Traverse all child nodes - must be either When or Otherwise while (elements.hasNext()) { SyntaxTreeNode element = elements.next(); // Add a When child element if (element instanceof When) { whenElements.addElement(element); } else // Add an Otherwise child element if (element instanceof Otherwise) { if (otherwise == null) { otherwise = (Otherwise) element; } else { error = new ErrorMsg(ErrorMsg.MULTIPLE_OTHERWISE_ERR, this); getParser().reportError(Constants.ERROR, error); } } else if (element instanceof Text) { ((Text) element).ignore(); } else // It is an error if we find some other element here { error = new ErrorMsg(ErrorMsg.WHEN_ELEMENT_ERR, this); getParser().reportError(Constants.ERROR, error); } } // Make sure that there is at least one <xsl:when> element if (whenElements.size() == 0) { error = new ErrorMsg(ErrorMsg.MISSING_WHEN_ERR, this); getParser().reportError(Constants.ERROR, error); return; } InstructionList il = methodGen.getInstructionList(); // next element will hold a handle to the beginning of next // When/Otherwise if test on current When fails BranchHandle nextElement = null; Vector exitHandles = new Vector(); InstructionHandle exit = null; Enumeration whens = whenElements.elements(); while (whens.hasMoreElements()) { final When when = (When) whens.nextElement(); final Expression test = when.getTest(); InstructionHandle truec = il.getEnd(); if (nextElement != null) nextElement.setTarget(il.append(NOP)); test.translateDesynthesized(classGen, methodGen); if (test instanceof FunctionCall) { FunctionCall call = (FunctionCall) test; try { Type type = call.typeCheck(getParser().getSymbolTable()); if (type != Type.Boolean) { test._falseList.add(il.append(new IFEQ(null))); } } catch (TypeCheckError e) { } } // remember end of condition truec = il.getEnd(); // for the support of a non-available element if (!when.ignore()) when.translateContents(classGen, methodGen); // goto exit after executing the body of when exitHandles.addElement(il.append(new GOTO(null))); if (whens.hasMoreElements() || otherwise != null) { nextElement = il.append(new GOTO(null)); test.backPatchFalseList(nextElement); } else test.backPatchFalseList(exit = il.append(NOP)); test.backPatchTrueList(truec.getNext()); } // Translate any <xsl:otherwise> element if (otherwise != null) { nextElement.setTarget(il.append(NOP)); otherwise.translateContents(classGen, methodGen); exit = il.append(NOP); } // now that end is known set targets of exit gotos Enumeration exitGotos = exitHandles.elements(); while (exitGotos.hasMoreElements()) { BranchHandle gotoExit = (BranchHandle) exitGotos.nextElement(); gotoExit.setTarget(exit); } }