Refine search
/** * Construct a new instance. * * @param uri the file name (may be {@code null} if this location does not correspond to a file) * @param original the location to copy the remainder of the information from */ XMLLocation(final URI uri, final Location original) { this(uri, original.getLineNumber(), original.getColumnNumber(), original.getCharacterOffset(), original.getPublicId(), original.getSystemId()); }
@Override public void report(String message, String errorType, Object relatedInformation, Location location) throws XMLStreamException { log.warn("Error:" + errorType + ", " + message + " at line " + location.getLineNumber() + ", col " + location.getColumnNumber()); } })
public static void addXMLLocation(BaseElement element, XMLStreamReader xtr) { Location location = xtr.getLocation(); element.setXmlRowNumber(location.getLineNumber()); element.setXmlColumnNumber(location.getColumnNumber()); }
public static String printEvent(XMLStreamReader xmlr) b.append("EVENT:[" + xmlr.getLocation().getLineNumber() + "][" + xmlr.getLocation().getColumnNumber() + "] "); b.append(getName(xmlr.getEventType())); b.append(" ["); switch (xmlr.getEventType()) {
private LoadedIdentity parseIdentity(final XMLStreamReader streamReader, final boolean skipCredentials, final boolean skipAttributes) throws RealmUnavailableException, XMLStreamException { final int tag = streamReader.nextTag(); if (tag != START_ELEMENT || ! validNamespace(streamReader.getNamespaceURI()) || ! "identity".equals(streamReader.getLocalName())) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } return parseIdentityContents(streamReader, skipCredentials, skipAttributes); }
private void parseCredential(final XMLStreamReader streamReader, CredentialParseFunction function) throws RealmUnavailableException, XMLStreamException { final int attributeCount = streamReader.getAttributeCount(); String name = null; String algorithm = null; String format = null; for (int i = 0; i < attributeCount; i ++) { String namespace = streamReader.getAttributeNamespace(i); if (namespace != null && !namespace.equals("")) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } final String localName = streamReader.getAttributeLocalName(i); if ("name".equals(localName)) { name = streamReader.getAttributeValue(i); } else if ("algorithm".equals(localName)) { algorithm = streamReader.getAttributeValue(i); } else if ("format".equals(localName)) { format = streamReader.getAttributeValue(i); } else { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } } final String text = streamReader.getElementText().trim(); function.parseCredential(algorithm, format, text); }
private void parseAttribute(final XMLStreamReader streamReader, final Attributes attributes) throws XMLStreamException, RealmUnavailableException { String name = null; String value = null; final int attributeCount = streamReader.getAttributeCount(); for (int i = 0; i < attributeCount; i++) { String namespace = streamReader.getAttributeNamespace(i); if (namespace != null && !namespace.equals("")) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name); } if ("name".equals(streamReader.getAttributeLocalName(i))) { name = streamReader.getAttributeValue(i); } else if ("value".equals(streamReader.getAttributeLocalName(i))) { value = streamReader.getAttributeValue(i); } else { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name); } } if (name == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("name", path, streamReader.getLocation().getLineNumber(), this.name); } if (value == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("value", path, streamReader.getLocation().getLineNumber(), this.name); } attributes.addLast(name, value); if (streamReader.nextTag() != END_ELEMENT) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name); } }
try { int state = stream.getEventType(); document.setBaseURI(stream.getLocation().getSystemId()); document.setProperty("ENCODING_SCHEME", stream.getCharacterEncodingScheme()); document.setProperty("STANDALONE", String.valueOf(stream.isStandalone()));
while(!rdr.isStartElement()) { rdr.next(); final Location loc = xse.getLocation(); XmlError e = XmlError.forLocation(xse.getMessage(), path, loc.getLineNumber(), loc.getColumnNumber(), loc.getCharacterOffset()); errors.add(e);
public void appendErrors(ErrorWriter errorWriter) { errorWriter.add("line number", String.valueOf(in.getLocation().getLineNumber())); }
private TldMetaData parseTLD(VirtualFile tld) throws DeploymentUnitProcessingException { if (IMPLICIT_TLD.equals(tld.getName())) { // Implicit TLDs are different from regular TLDs return new TldMetaData(); } InputStream is = null; try { is = tld.openStream(); final XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setXMLResolver(NoopXMLResolver.create()); XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is); return TldMetaDataParser.parse(xmlReader); } catch (XMLStreamException e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(tld.toString(), e.getLocation().getLineNumber(), e.getLocation().getColumnNumber()), e); } catch (IOException e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(tld.toString()), e); } finally { try { if (is != null) { is.close(); } } catch (IOException e) { // Ignore } } }
log.error(e.getMessage() + " at line " + e.getLocation().getLineNumber() + ", col " + e.getLocation().getColumnNumber()); e.getCause().printStackTrace(); List<String> lines = IOUtils.readLines(is); String line = lines.get( e.getLocation().getLineNumber()-1); if (e.getLocation().getColumnNumber()>PRIOR_CHARS) { start = e.getLocation().getColumnNumber() - PRIOR_CHARS; int end = e.getLocation().getColumnNumber() + PRIOR_CHARS; if (end > line.length()-1 ) { end = line.length()-1; xmlr.close(); xmlWriter.flush(); xmlWriter.close();
@Override public XmlIterator iterator() { try { return new XmlIterator(getInputFactory().createXMLStreamReader(inputStream), query); } catch (XMLStreamException e) { throw new MalformedXMLException(e.getMessage(), e.getLocation().getLineNumber()); } } };
private void handleDtd() throws SAXException { if (getLexicalHandler() != null) { Location location = this.reader.getLocation(); getLexicalHandler().startDTD(null, location.getPublicId(), location.getSystemId()); } if (getLexicalHandler() != null) { getLexicalHandler().endDTD(); } }
private static void lineNumber(XMLStreamReader xsr, LoadContext context) { javax.xml.stream.Location loc = xsr.getLocation(); if (loc != null) { context.lineNumber(loc.getLineNumber(), loc.getColumnNumber(), loc.getCharacterOffset()); } }
@Override public int getLineNumber() { return (location != null ? location.getLineNumber() : -1); } @Override
errors.add("bad conf file: " + e.getMessage()); int line = element.getLocation().getLineNumber(); duplicatedProperties.put(v, lines); lines.add(node.getStartElement().getLocation().getLineNumber());
public LocationImpl(Location loc) { this.lineNumber = loc.getLineNumber(); this.columnNumber = loc.getColumnNumber(); this.systemId = loc.getSystemId(); }
/** * Unlike with reader source, we won't start from beginning of a file, * but usually from somewhere in the middle... */ protected void doInitInputLocation(WstxInputData reader) { reader.mCurrInputProcessed = mContentStart.getCharacterOffset(); reader.mCurrInputRow = mContentStart.getLineNumber(); /* 13-Apr-2005, TSa: Since column offsets reported by Location * objects are 1-based, but internally we use 0-based counts, * need to offset this start by 1 to begin with. */ reader.mCurrInputRowStart = -mContentStart.getColumnNumber() + 1; }
public String getMessage() { if(location==null) return super.getMessage(); return String.format("%s at %s line %d", super.getMessage(), location.getSystemId(), location.getLineNumber()); } }