private static CommonTokenStream feedLexer(CSSInputStream source, StyleSheet stylesheet) throws CSSException { // we have to unpack runtime exception // because of Java limitation // to change method contract with different type of exception try { CSSLexer lexer = new CSSLexer(source); lexer.init(stylesheet); return new CommonTokenStream(lexer); } catch (RuntimeException re) { if (re.getCause() instanceof CSSException) { throw (CSSException) re.getCause(); } // this is some other exception else { log.error("LEXER THROWS:", re); throw re; } } }
private static CommonTokenStream feedLexer(CSSInputStream source) throws CSSException { // we have to unpack runtime exception // because of Java limitation // to change method contract with different type of exception try { CSSLexer lexer = new CSSLexer(source); lexer.init(); return new CommonTokenStream(lexer); } catch (RuntimeException re) { if (re.getCause() instanceof CSSException) { throw (CSSException) re.getCause(); } // this is some other exception else { log.error("LEXER THROWS:", re); throw re; } } }