Refine search
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); } }
/** * 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() + "."); } }
addTextIfNeeded(); final Element el = doc.createElement(qName); for (int i = 0; i < attributes.getLength(); i++) { el.setAttribute(attributes.getQName(i), attributes.getValue(i)); el.setUserData(LINE_NUMBER_KEY_NAME, String.valueOf(this.locator.getLineNumber()), null); elementStack.push(el);
if(null != locator) slocator.setLineNumber(locator.getLineNumber()); slocator.setColumnNumber(locator.getColumnNumber()); slocator.setPublicId(locator.getPublicId()); slocator.setSystemId(locator.getSystemId()); int n = attributes.getLength(); String attrLocalName = attributes.getLocalName(i); String attrUri = attributes.getURI(i); String value = attributes.getValue(i); !declaredXSLNS(stylesheet)) throw new org.xml.sax.SAXException(XSLMessages.createWarning(XSLTErrorResources.WG_OLD_XSLT_NS, null)); throw new org.xml.sax.SAXException(e); throw new org.xml.sax.SAXException(te);
public void fatalError(SAXParseException e) throws SAXException { if (this.locator != null) { throw new SAXException("Error Traced[line: " + this.locator.getLineNumber() + "] " + e.getMessage()); } else { throw e; } }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ("test".equals(qName) && attributes != null && suite.equals(attributes.getValue("name"))) { line = loc.getLineNumber(); column = loc.getColumnNumber() - suite.length() - 3; } }
/** * 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()); }
/** * 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); } }
@Override public void error(SAXParseException arg0) throws SAXException { throw new SAXException( "line " + locator.getLineNumber() + ":" + locator.getColumnNumber() + " " + arg0.getMessage()); }
protected String findExternalResource(String nsURI, String localName, org.xml.sax.Attributes atts) { if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(nsURI) && ("import".equals(localName) || "include".equals(localName))) { String s = atts.getValue("schemaLocation"); if (!StringUtils.isEmpty(s)) { s = mapSchemaLocation(s, locator.getSystemId(), catalog); } return s; } return null; } }
protected void unexpectedX(String token) throws SAXException { throw new SAXParseException(MessageFormat.format( "Unexpected {0} appears at line {1} column {2}", new Object[]{ token, new Integer(getLocator().getLineNumber()), new Integer(getLocator().getColumnNumber()) }), getLocator()); }
private static String makeMessage(String message, Locator locator) { return makeMessage(message, locator.getLineNumber(), locator.getColumnNumber()); }
@Override public int getLineNumber() { return this.locator.getLineNumber(); }
@Override public String getSystemId() { return this.locator.getSystemId(); } }
@Override public int getColumnNumber() { return this.locator.getColumnNumber(); }
@Override public void handleMultiple() { throw XmlLogger.LOG.multipleDecorators(file + "@" + locator.getLineNumber()); } });
@Override public void handleMultiple() { throw XmlLogger.LOG.multipleInterceptors(file + "@" + locator.getLineNumber()); } });
@Override public void handleMultiple() { throw XmlLogger.LOG.multipleAlternatives(file + "@" + locator.getLineNumber()); } });