Refine search
@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 void appendErrors(ErrorWriter errorWriter) { errorWriter.add("line number", String.valueOf(in.getLocation().getLineNumber())); }
public static void addXMLLocation(GraphicInfo graphicInfo, XMLStreamReader xtr) { Location location = xtr.getLocation(); graphicInfo.setXmlRowNumber(location.getLineNumber()); graphicInfo.setXmlColumnNumber(location.getColumnNumber()); }
/** * 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 XMLLocation includedFrom, final URI uri, final Location original) { this(includedFrom, uri, original.getLineNumber(), original.getColumnNumber(), original.getCharacterOffset(), original.getPublicId(), original.getSystemId()); }
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 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()); } }
/** * 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()); }
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); }
public static String printEvent(XMLStreamReader xmlr) b.append("EVENT:[" + xmlr.getLocation().getLineNumber() + "][" + xmlr.getLocation().getColumnNumber() + "] "); b.append(getName(xmlr.getEventType())); b.append(" [");
/** * Construct a new instance. * * @param original the location to copy the remainder of the information from */ XMLLocation(final Location original) { this(original instanceof XMLLocation ? ((XMLLocation)original).getUri() : null, original.getLineNumber(), original.getColumnNumber(), original.getCharacterOffset(), original.getPublicId(), original.getSystemId()); }
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); } }
public LoaderException(String message, XMLStreamReader reader) { super(message); Location location = reader.getLocation(); line = location.getLineNumber(); column = location.getColumnNumber(); resourceURI = location.getSystemId(); }
outputRowData[data.pos_xml_location_line] = new Long( e.getLocation().getLineNumber() ); outputRowData[data.pos_xml_location_column] = new Long( e.getLocation().getColumnNumber() );
private Attributes parseAttributes(final XMLStreamReader streamReader) throws RealmUnavailableException, XMLStreamException { final int attributeCount = streamReader.getAttributeCount(); if (attributeCount > 0) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } int tag = streamReader.nextTag(); if (tag == END_ELEMENT) { return Attributes.EMPTY; } Attributes attributes = new MapAttributes(); do { if (! validNamespace(streamReader.getNamespaceURI())) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } if ("attribute".equals(streamReader.getLocalName())) { parseAttribute(streamReader, attributes); } else { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } } while (streamReader.nextTag() == START_ELEMENT); return attributes; }
@Override public String unexpectedAttribute(XMLStreamReader reader, int index) { Location location = reader.getLocation(); return this.tr("Unexpected <{2} {3}=\"...\"/> attribute found at [{0}:{1}]", location.getLineNumber(), location.getColumnNumber(), reader.getLocalName(), reader.getAttributeLocalName(index)); }
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;
private void parsePublicKey(final List<Credential> credentials, final XMLStreamReader streamReader) throws RealmUnavailableException, XMLStreamException { parseCredential(streamReader, (algorithm, format, text) -> { if (algorithm == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("algorithm", path, streamReader.getLocation().getLineNumber(), name); } if (format == null) { format = X509_FORMAT; } else if (!X509_FORMAT.equals(format)) { throw ElytronMessages.log.fileSystemRealmUnsupportedKeyFormat(format, path, streamReader.getLocation().getLineNumber(), name); } try { KeyFactory keyFactory = KeyFactory.getInstance(algorithm); credentials.add(new PublicKeyCredential(keyFactory.generatePublic(new PKCS8EncodedKeySpec(CodePointIterator.ofString(text).base64Decode().drain())))); } catch (NoSuchAlgorithmException e) { throw ElytronMessages.log.fileSystemRealmUnsupportedKeyAlgorithm(format, path, streamReader.getLocation().getLineNumber(), name, e); } catch (InvalidKeySpecException e) { throw ElytronMessages.log.fileSystemRealmUnsupportedKeyFormat(format, path, streamReader.getLocation().getLineNumber(), name); } }); }
@Override public String invalidAttribute(XMLStreamReader reader, int index) { Location location = reader.getLocation(); return this.tr("Invalid value for <{2} {3}=\"{4}\"/> found at [{0}:{1}]", location.getLineNumber(), location.getColumnNumber(), reader.getLocalName(), reader.getAttributeLocalName(index), reader.getAttributeValue(index)); }
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 } } }