Refine search
/** * Creates a location from the SAX locator using the system ID as * the filename. * * @param loc Must not be <code>null</code>. * * @since Ant 1.6 */ public Location(Locator loc) { this(loc.getSystemId(), loc.getLineNumber(), loc.getColumnNumber()); }
private void checkRefNumber(int refNumber) throws SAXException { if (refNumber > patternTokens.size()) { throw new SAXException("Only backward references in match elements are possible, tried to specify token " + refNumber + "\n" + "Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); } }
/** * Formats the current document location. */ private String getLocation() { return locator.getSystemId() + ':' + locator.getLineNumber(); }
/** * Set a location associated with the exception. * @param locator the locator holding the location. */ public void setLocator(Locator locator) { if (locator != null) { this.systemId = locator.getSystemId(); this.line = locator.getLineNumber(); this.column = locator.getColumnNumber(); } }
private void refNumberSanityCheck(int refNumber) throws SAXException { if (refNumber > patternTokens.size()) { throw new SAXException("Only backward references in match elements are possible, tried to specify token " + refNumber + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); } }
/** * Constructs an object from an org.xml.sax.Locator. * * The object's ColumnNumber, LineNumber, and URL become available from the * values returned by the locator's getColumnNumber(), getLineNumber(), and * getSystemId() methods respectively. Node, Object, and Offset are not * available. * * @param loc the SAX Locator object that will be used to populate this * event locator. * @throws IllegalArgumentException if the Locator is null */ public ValidationEventLocatorImpl( Locator loc ) { if( loc == null ) { throw new IllegalArgumentException( Messages.format( Messages.MUST_NOT_BE_NULL, "loc" ) ); } this.url = toURL(loc.getSystemId()); this.columnNumber = loc.getColumnNumber(); this.lineNumber = loc.getLineNumber(); }
private void checkNumber(Attributes attrs) throws SAXException { if (StringTools.isEmpty(attrs.getValue("no"))) { throw new SAXException("References cannot be empty: " + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); } else if (Integer.parseInt(attrs.getValue("no")) < 1 && regex.length() == 0) { throw new SAXException("References must be larger than 0: " + attrs.getValue("no") + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); } }
/** * Create a new SAXParseException from a message and a Locator. * * <p>This constructor is especially useful when an application is * creating its own exception from within a {@link org.xml.sax.ContentHandler * ContentHandler} callback.</p> * * @param message The error or warning message. * @param locator The locator object for the error or warning (may be * null). * @see org.xml.sax.Locator */ public SAXParseException (String message, Locator locator) { super(message); if (locator != null) { init(locator.getPublicId(), locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); } else { init(null, null, -1, -1); } }
private static String makeMessage(String message, Locator locator) { return makeMessage(message, locator.getLineNumber(), locator.getColumnNumber()); }
/** * Store the source location of the current node. This method must be called * as every node is added to the DTM or for no node. */ protected void setSourceLocation() { m_sourceSystemId.addElement(m_locator.getSystemId()); m_sourceLine.addElement(m_locator.getLineNumber()); m_sourceColumn.addElement(m_locator.getColumnNumber()); //%REVIEW% %BUG% Prevent this from arising in the first place // by not allowing the enabling conditions to change after we start // building the document. if (m_sourceSystemId.size() != m_size) { String msg = "CODING ERROR in Source Location: " + m_size + " != " + m_sourceSystemId.size(); System.err.println(msg); throw new RuntimeException(msg); } }
/** Report error occured during custom validation. */ protected void error(String reason) throws SAXException { StringBuffer buf = new StringBuffer (reason).append(": ").append(fo.toString());//NOI18N if (locator != null) { buf.append(" line: ").append(locator.getLineNumber());//NOI18N buf.append(" column: ").append(locator.getColumnNumber());//NOI18N } String msg = buf.toString(); //NOI18N SAXException sex = new SAXException(msg); throw sex; }
/** * Wrap an existing exception in a SAXParseException. * * <p>This constructor is especially useful when an application is * creating its own exception from within a {@link org.xml.sax.ContentHandler * ContentHandler} callback, and needs to wrap an existing exception that is not a * subclass of {@link org.xml.sax.SAXException SAXException}.</p> * * @param message The error or warning message, or null to * use the message from the embedded exception. * @param locator The locator object for the error or warning (may be * null). * @param e Any exception. * @see org.xml.sax.Locator */ public SAXParseException (String message, Locator locator, Exception e) { super(message, e); if (locator != null) { init(locator.getPublicId(), locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber()); } else { init(null, null, -1, -1); } }
/** * Create a SAX exception which also understands about the location in * the digester file where the exception occurs * * @return the new exception */ public SAXException createSAXException(String message, Exception e) { if ((e != null) && (e instanceof InvocationTargetException)) { Throwable t = ((InvocationTargetException) e).getTargetException(); if ((t != null) && (t instanceof Exception)) { e = (Exception) t; } } if (locator != null) { String error = "Error at line " + locator.getLineNumber() + " char " + locator.getColumnNumber() + ": " + message; if (e != null) { return new SAXParseException(error, locator, e); } else { return new SAXParseException(error, locator); } } log.error("No Locator!"); if (e != null) { return new SAXException(message, e); } else { return new SAXException(message); } }
/** * Constructor SAXSourceLocator * * * @param locator Source locator */ public SAXSourceLocator(Locator locator) { m_locator = locator; this.setColumnNumber(locator.getColumnNumber()); this.setLineNumber(locator.getLineNumber()); this.setPublicId(locator.getPublicId()); this.setSystemId(locator.getSystemId()); }
+ newWdList.size() + " must be equal to the number of matched tokens (" + matchedTokenCount + ")" + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); throw new SAXException(language.getName() + " rule error. The number unified tokens: " + uniCounter + " must be equal to the number of matched tokens: " + matchedTokenCount + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); throw new SAXException( language.getName() + " rule error. Cannot replace or filter more than one token at a time." + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); "first token in the AND group.\n You attempted to set these " + "attributes on the token no. " + (andGroupCounter + 1) + "." + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + ".");
/** * Store the source location of the current node. This method must be called * as every node is added to the DTM or for no node. */ protected void setSourceLocation() { m_sourceSystemId.addElement(m_locator.getSystemId()); m_sourceLine.addElement(m_locator.getLineNumber()); m_sourceColumn.addElement(m_locator.getColumnNumber()); //%REVIEW% %BUG% Prevent this from arising in the first place // by not allowing the enabling conditions to change after we start // building the document. if (m_sourceSystemId.size() != m_size) { String msg = "CODING ERROR in Source Location: " + m_size + " != " + m_sourceSystemId.size(); System.err.println(msg); throw new RuntimeException(msg); } }
"first token in the AND group.\n You attempted to set these " + "attributes on the token no. " + (andGroupCounter + 1) + "." + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + ".");
/** * Constructor SAXSourceLocator * * * @param locator Source locator */ public SAXSourceLocator(Locator locator) { m_locator = locator; this.setColumnNumber(locator.getColumnNumber()); this.setLineNumber(locator.getLineNumber()); this.setPublicId(locator.getPublicId()); this.setSystemId(locator.getSystemId()); }
/** * Implementation of error. * * @param exception * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) */ public void error(SAXParseException exception) { logger.severe("ERROR " + exception.getMessage()); logger.severe("col " + locator.getColumnNumber() + ", line " + locator.getLineNumber()); }
/** * Copy constructor. * * <p>Create a persistent copy of the current state of a locator. * When the original locator changes, this copy will still keep * the original values (and it can be used outside the scope of * DocumentHandler methods).</p> * * @param locator The locator to copy. */ public LocatorImpl (Locator locator) { setPublicId(locator.getPublicId()); setSystemId(locator.getSystemId()); setLineNumber(locator.getLineNumber()); setColumnNumber(locator.getColumnNumber()); }