/** * Print an error message. * @param message The message to print. * @param exception The exception for stack tracing. */ public void error (String message, ParserException exception) { if (QUIET != mMode) { System.out.println ("ERROR: " + message); if (DEBUG == mMode && (null != exception)) exception.printStackTrace (); } } }
void string() : { Token t ; } { t = <STRING> ( <NAME> | <MISSING_SEMI> {throw new ParserException( "STRING must be followed by a \";\". at line" +t.beginLine+ ", column " +t.beginColumn+ "." ) ; } ) }
throw new IOException (pe.getMessage ()); throw new IOException (pe.getMessage ());
throwable = pe.getThrowable (); if (null != throwable) System.err.println ("broken link " + ((FileNotFoundException)throwable).getMessage () + " ignored"); else pe.printStackTrace (); pe.printStackTrace ();
StringBuffer msg = new StringBuffer("<!--\n").append(pex.getLocalizedMessage()).append("\n"); pex.printStackTrace(writer); msg.append(stackTrace.toString()).append("\n-->"); result = msg.toString();
e.printStackTrace(); throw new IOException(e.getMessage());
StringBuffer msg = new StringBuffer("<!--\n").append(pex.getLocalizedMessage()).append("\n"); pex.printStackTrace(writer); msg.append(stackTrace.toString()).append("\n-->"); result = msg.toString();
e.printStackTrace(); throw new IOException(e.getMessage());
/** * Refetch the URL contents. * Only need to worry if there is already a valid parser and it's * been spent fetching the string contents. */ private void resetStrings () { if (null != mStrings) try { mParser.setURL (getURL ()); setStrings (); } catch (ParserException pe) { updateStrings (pe.toString ()); } }
public void annotateHTMLContent(InputStream is, String charSet, String fileContext, CaptureSearchResult result) { ParseContext context = new ParseContext(); Node node; try { ContextAwareLexer lex = new ContextAwareLexer( new Lexer(new Page(is,charSet)),context); while((node = lex.nextNode()) != null) { // System.err.println("\nDEBUG-Node:js("+context.isInJS()+")css("+context.isInCSS()+"):"); // System.err.println("-------------------/START"); // System.err.println(node.toHtml(true)); // System.err.println("-------------------/END"); rules.handleNode(context, node); } rules.handleParseComplete(context); } catch (ParserException e) { // TODO Auto-generated catch block e.printStackTrace(); LOGGER.warning(fileContext + " " + e.getLocalizedMessage()); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); LOGGER.warning(fileContext + " " + e.getLocalizedMessage()); } catch (IOException e) { LOGGER.warning(fileContext + " " + e.getLocalizedMessage()); } } }
throw new ParserException ("URL " + link + " has a problem", e);
throw new DocumentReadException(e.getMessage(), e);
updateStrings (pe.toString ());
public void annotateHTMLContent(InputStream is, String charSet, String fileContext, CaptureSearchResult result) { ParseContext context = new ParseContext(); Node node; try { ContextAwareLexer lex = new ContextAwareLexer( new Lexer(new Page(is,charSet)),context); while((node = lex.nextNode()) != null) { // System.err.println("\nDEBUG-Node:js("+context.isInJS()+")css("+context.isInCSS()+"):"); // System.err.println("-------------------/START"); // System.err.println(node.toHtml(true)); // System.err.println("-------------------/END"); rules.handleNode(context, node); } rules.handleParseComplete(context); } catch (ParserException e) { // TODO Auto-generated catch block e.printStackTrace(); LOGGER.warning(fileContext + " " + e.getLocalizedMessage()); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); LOGGER.warning(fileContext + " " + e.getLocalizedMessage()); } catch (IOException e) { LOGGER.warning(fileContext + " " + e.getLocalizedMessage()); } } }
|| (0 != substate_checksum) || (0 != substate_final)) throw new ParserException ("illegal state for exit"); state = STATE_DONE; throw new ParserException ("illegal length: " + length); substate_length = 0; state = STATE_PREFIX; substate_prefix++; else throw new ParserException ("illegal character encountered: " + (int)character + " ('" + character + "')"); if (substate_prefix >= mPrefix.length) input_character -= ' ' - 1; else throw new ParserException ("illegal encoded character: " + input_character + " ('" + character + "')"); char ch = mLookupTable[mEncodingIndex[index % 64]][input_character]; ret.append (ch); throw new ParserException ("unexpected escape character: " + (int)character + " ('" + character + "')"); ret.append (character); checksum += character; throw new ParserException ("incorrect checksum, expected " + check + ", calculated " + checksum); checksum = 0; substate_checksum = 0; substate_final++;
message = pe.getMessage (); if ((null != message) && (message.endsWith ("does not contain text")))
updateStrings(pe.toString());