Java 8 ErrorListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ErrorListener class.

This code example shows how to use the following methods:error, fatalError
    public void testErrorListener() throws Exception {
        // Xalan transformer cannot work as expected, so we just skip the test 
        if (xsltBuilder.isXalanTransformer(xsltBuilder.getConverter().getTransformerFactory().newTransformer())) {
            return; 
        } 
        errorListener.error(EasyMock.<TransformerException>anyObject());
        expectLastCall().atLeastOnce(); 
 
        errorListener.fatalError(EasyMock.<TransformerException>anyObject());
        expectLastCall().once(); 
        replay(errorListener);
 
        URL styleSheet = getClass().getResource("example-with-errors.xsl");
        try { 
            xsltBuilder.setErrorListener(errorListener);
            xsltBuilder.setTransformerURL(styleSheet);
            fail("Should throw exception");
        } catch (Exception ex) {
            // expected 
        } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:error, fatalError
 
    private XsltBuilder xsltBuilder = new XsltBuilder();
    private ErrorListener errorListener = createMock(ErrorListener.class);
 
    public void testErrorListener() throws Exception { 
        errorListener.error(EasyMock.<TransformerException>anyObject());
        expectLastCall().atLeastOnce(); 
 
        errorListener.fatalError(EasyMock.<TransformerException>anyObject());
        expectLastCall().once(); 
        replay(errorListener);
 
        URL styleSheet = getClass().getResource("example-with-errors.xsl");
        try { 
            xsltBuilder.setErrorListener(errorListener);
            xsltBuilder.setTransformerURL(styleSheet);
            fail("Should throw exception");
        } catch (Exception ex) {
            // expected 
        } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:warning
  { 
 
    String formattedMsg = XSLMessages.createWarning(msg, args);
    ErrorListener errHandler = xctxt.getErrorListener();
 
    errHandler.warning(new TransformerException(formattedMsg,
                                             (SAXSourceLocator)xctxt.getSAXLocator()));
  } 
 
  /** 
   * Overide the superclass method to allow one or two arguments.  
   * 
   * 
   * @param argNum Number of arguments passed in 
   * 
   * @throws WrongNumberArgsException 
   */ 
  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
  { 
    if ((argNum > 3) || (argNum < 2))
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:fatalError
    //                    ((Locator)m_stylesheetLocatorStack.peek()); 
    // Locator locator = null; 
    ErrorListener errHandler = m_transformer.getErrorListener();
 
    if (null != errHandler)
      errHandler.fatalError(new TransformerException(formattedMsg, srcLctr));
    else 
      throw new TransformerException(formattedMsg, srcLctr);
  } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:fatalError
This code example shows how to use the following methods:fatalError
                createXSLTCTransformerFactory(); 
            } 
	    ErrorListener errorListener = _xsltcFactory.getErrorListener();
            if(errorListener != null) {
                try { 
                    errorListener.fatalError(e1);
                    return null; 
                } 
                catch( TransformerException e2) {
                    new TransformerConfigurationException(e2);
                } 
            } 
            throw e1;
        } 
    } 
} 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:fatalError
This code example shows how to use the following methods:fatalError
    if (null != xctxt)
    { 
      ErrorListener eh = xctxt.getErrorListener();
      TransformerException te = new TransformerException(fmsg, this);
 
      eh.fatalError(te);
    } 
  } 
   
  /** 
   * Get the first non-Expression parent of this node. 
   * @return null or first ancestor that is not an Expression. 
   */ 
  public ExpressionNode getExpressionOwner() 
  { 
  	ExpressionNode parent = exprGetParent();
  	while((null != parent) && (parent instanceof Expression))
  		parent = parent.exprGetParent();
  	return parent;
  } 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:fatalError
  public void fatalError (SAXParseException e)
    throws SAXException 
  { 
    try 
      { 
        listener.fatalError (new TransformerException (e));
      } 
    catch (TransformerException te)
      { 
        throw getSAXException (te);
      } 
  } 
 
  private SAXException getSAXException (TransformerException e)
  { 
    Throwable cause = e.getCause ();
    if (cause instanceof SAXException)
      { 
        return (SAXException) cause;
      } 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:warning
  public void warning (SAXParseException e)
    throws SAXException 
  { 
    try 
      { 
        listener.warning (new TransformerException (e));
      } 
    catch (TransformerException te)
      { 
        throw getSAXException (te);
      } 
  } 
 
  public void error (SAXParseException e)
    throws SAXException 
  { 
    try 
      { 
        listener.error (new TransformerException (e));
      } 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Java 8 ErrorListener Questions & Answers:

See Code Examples for Java 8 ErrorListener Methods: