public String toString() { return getClass() + ": " + getXPath() + ": " + getPosition() + ": " + getMessage(); }
/** * <p> * Returns a long formatted description of the error, * including line breaks. * </p> * * @return a longer description of the error on multiple lines */ public String getMultilineMessage() { StringBuffer buf = new StringBuffer(); buf.append( getMessage() ); buf.append( lineSeparator ); buf.append( getXPath() ); buf.append( lineSeparator ); buf.append( getPositionMarker() ); return buf.toString(); }
/** * Create a new XPathSyntaxException wrapping an existing * <code>org.jaxen.saxpath.XPathSyntaxException</code>. * * @param e the exception that caused this exception */ public XPathSyntaxException(org.jaxen.saxpath.XPathSyntaxException e) { super( e ); this.xpath = e.getXPath(); this.position = e.getPosition(); }
private void throwInvalidAxis(String invalidAxis) throws SAXPathException { String xpath = this.lexer.getXPath(); int position = LT(1).getTokenBegin(); String message = "Expected valid axis name instead of [" + invalidAxis + "]"; throw new XPathSyntaxException( xpath, position, message ); } }
/** * <p> * Returns a string in the form <code>" ^"</code> which, when placed on the line * below the XPath expression in a monospaced font, should point to the * location of the error. * </p> * * @return the position marker */ private String getPositionMarker() { int pos = getPosition(); StringBuffer buf = new StringBuffer(pos+1); for ( int i = 0 ; i < pos ; ++i ) { buf.append(" "); } buf.append("^"); return buf.toString(); }
private XPathSyntaxException createSyntaxException(String message) { String xpath = this.lexer.getXPath(); int position = LT(1).getTokenBegin(); return new XPathSyntaxException( xpath, position, message ); }