Java Code Examples for org.xml.sax.helpers.LocatorImpl#setLineNumber()

The following examples show how to use org.xml.sax.helpers.LocatorImpl#setLineNumber() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SchemaContentHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static void convertToSAXParseException(XMLParseException e) throws SAXException {
    Exception ex = e.getException();
    if (ex == null) {
        // must be a parser exception; mine it for locator info and throw
        // a SAXParseException
        LocatorImpl locatorImpl = new LocatorImpl();
        locatorImpl.setPublicId(e.getPublicId());
        locatorImpl.setSystemId(e.getExpandedSystemId());
        locatorImpl.setLineNumber(e.getLineNumber());
        locatorImpl.setColumnNumber(e.getColumnNumber());
        throw new SAXParseException(e.getMessage(), locatorImpl);
    }
    if (ex instanceof SAXException) {
        // why did we create an XMLParseException?
        throw (SAXException) ex;
    }
    throw new SAXException(ex);
}
 
Example 2
Source File: WsimportOptions.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Exposing it as a public method to allow external tools such as NB to read from wsdl model and work on it.
 * TODO: WSDL model needs to be exposed - basically at tool time we need to use the runtimw wsdl model
 *
 * Binding files could be jaxws or jaxb. This method identifies jaxws and jaxb binding files and keeps them separately. jaxb binding files are given separately
 * to JAXB in {@link com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder}
 *
 * @param receiver {@link ErrorReceiver}
 */
public final void parseBindings(ErrorReceiver receiver){
    for (InputSource is : bindingFiles) {
        XMLStreamReader reader =
                XMLStreamReaderFactory.create(is,true);
        XMLStreamReaderUtil.nextElementContent(reader);
        if (reader.getName().equals(JAXWSBindingsConstants.JAXWS_BINDINGS)) {
            jaxwsCustomBindings.add(new RereadInputSource(is));
        } else if (reader.getName().equals(JAXWSBindingsConstants.JAXB_BINDINGS) ||
                reader.getName().equals(new QName(SchemaConstants.NS_XSD, "schema"))) {
            jaxbCustomBindings.add(new RereadInputSource(is));
        } else {
            LocatorImpl locator = new LocatorImpl();
            locator.setSystemId(reader.getLocation().getSystemId());
            locator.setPublicId(reader.getLocation().getPublicId());
            locator.setLineNumber(reader.getLocation().getLineNumber());
            locator.setColumnNumber(reader.getLocation().getColumnNumber());
            receiver.warning(locator, ConfigurationMessages.CONFIGURATION_NOT_BINDING_FILE(is.getSystemId()));
        }
    }
}
 
Example 3
Source File: SchemaContentHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
static void convertToSAXParseException(XMLParseException e) throws SAXException {
    Exception ex = e.getException();
    if (ex == null) {
        // must be a parser exception; mine it for locator info and throw
        // a SAXParseException
        LocatorImpl locatorImpl = new LocatorImpl();
        locatorImpl.setPublicId(e.getPublicId());
        locatorImpl.setSystemId(e.getExpandedSystemId());
        locatorImpl.setLineNumber(e.getLineNumber());
        locatorImpl.setColumnNumber(e.getColumnNumber());
        throw new SAXParseException(e.getMessage(), locatorImpl);
    }
    if (ex instanceof SAXException) {
        // why did we create an XMLParseException?
        throw (SAXException) ex;
    }
    throw new SAXException(ex);
}
 
Example 4
Source File: SchemaContentHandler.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
static void convertToSAXParseException(XMLParseException e) throws SAXException {
    Exception ex = e.getException();
    if (ex == null) {
        // must be a parser exception; mine it for locator info and throw
        // a SAXParseException
        LocatorImpl locatorImpl = new LocatorImpl();
        locatorImpl.setPublicId(e.getPublicId());
        locatorImpl.setSystemId(e.getExpandedSystemId());
        locatorImpl.setLineNumber(e.getLineNumber());
        locatorImpl.setColumnNumber(e.getColumnNumber());
        throw new SAXParseException(e.getMessage(), locatorImpl);
    }
    if (ex instanceof SAXException) {
        // why did we create an XMLParseException?
        throw (SAXException) ex;
    }
    throw new SAXException(ex);
}
 
Example 5
Source File: LocatableWebServiceException.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static Locator toLocation(XMLStreamReader xsr) {
    LocatorImpl loc = new LocatorImpl();
    Location in = xsr.getLocation();
    loc.setSystemId(in.getSystemId());
    loc.setPublicId(in.getPublicId());
    loc.setLineNumber(in.getLineNumber());
    loc.setColumnNumber(in.getColumnNumber());
    return loc;
}
 
Example 6
Source File: LocatableWebServiceException.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static Locator toLocation(XMLStreamReader xsr) {
    LocatorImpl loc = new LocatorImpl();
    Location in = xsr.getLocation();
    loc.setSystemId(in.getSystemId());
    loc.setPublicId(in.getPublicId());
    loc.setLineNumber(in.getLineNumber());
    loc.setColumnNumber(in.getColumnNumber());
    return loc;
}
 
Example 7
Source File: Model.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @deprecated
 *      No line number available for the "root" component.
 */
public Locator getLocator() {
    LocatorImpl r = new LocatorImpl();
    r.setLineNumber(-1);
    r.setColumnNumber(-1);
    return r;
}
 
Example 8
Source File: CompactSyntax.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void doError(String message, Token tok) {
  hadError = true;
  if (eh != null) {
    LocatorImpl loc = new LocatorImpl();
    loc.setLineNumber(tok.beginLine);
    loc.setColumnNumber(tok.beginColumn);
    loc.setSystemId(sourceUri);
    try {
      eh.error(new SAXParseException(message, loc));
    }
    catch (SAXException se) {
      throw new BuildException(se);
    }
  }
}
 
Example 9
Source File: Model.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @deprecated
 *      No line number available for the "root" component.
 */
public Locator getLocator() {
    LocatorImpl r = new LocatorImpl();
    r.setLineNumber(-1);
    r.setColumnNumber(-1);
    return r;
}
 
Example 10
Source File: WSDLParserExtensionFacade.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private Locator getLocator(XMLStreamReader reader) {
    Location location = reader.getLocation();
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(location.getSystemId());
        loc.setLineNumber(location.getLineNumber());
    return loc;
}
 
Example 11
Source File: WSDLParserExtensionFacade.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private Locator getLocator(XMLStreamReader reader) {
    Location location = reader.getLocation();
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(location.getSystemId());
        loc.setLineNumber(location.getLineNumber());
    return loc;
}
 
Example 12
Source File: CompactSyntax.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void reportEscapeSyntaxException(EscapeSyntaxException e) {
  if (eh != null) {
    LocatorImpl loc = new LocatorImpl();
    loc.setLineNumber(e.getLineNumber());
    loc.setColumnNumber(e.getColumnNumber());
    loc.setSystemId(sourceUri);
    try {
      eh.error(new SAXParseException(localizer.message(e.getKey()), loc));
    }
    catch (SAXException se) {
      throw new BuildException(se);
    }
  }
}
 
Example 13
Source File: CompactSyntax.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void doError(String message, Token tok) {
  hadError = true;
  if (eh != null) {
    LocatorImpl loc = new LocatorImpl();
    loc.setLineNumber(tok.beginLine);
    loc.setColumnNumber(tok.beginColumn);
    loc.setSystemId(sourceUri);
    try {
      eh.error(new SAXParseException(message, loc));
    }
    catch (SAXException se) {
      throw new BuildException(se);
    }
  }
}
 
Example 14
Source File: WSDLParserExtensionFacade.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Locator getLocator(XMLStreamReader reader) {
    Location location = reader.getLocation();
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(location.getSystemId());
        loc.setLineNumber(location.getLineNumber());
    return loc;
}
 
Example 15
Source File: LocatableWebServiceException.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static Locator toLocation(XMLStreamReader xsr) {
    LocatorImpl loc = new LocatorImpl();
    Location in = xsr.getLocation();
    loc.setSystemId(in.getSystemId());
    loc.setPublicId(in.getPublicId());
    loc.setLineNumber(in.getLineNumber());
    loc.setColumnNumber(in.getColumnNumber());
    return loc;
}
 
Example 16
Source File: CompactSyntax.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void doError(String message, Token tok) {
  hadError = true;
  if (eh != null) {
    LocatorImpl loc = new LocatorImpl();
    loc.setLineNumber(tok.beginLine);
    loc.setColumnNumber(tok.beginColumn);
    loc.setSystemId(sourceUri);
    try {
      eh.error(new SAXParseException(message, loc));
    }
    catch (SAXException se) {
      throw new BuildException(se);
    }
  }
}
 
Example 17
Source File: LocatableWebServiceException.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Locator toLocation(XMLStreamReader xsr) {
    LocatorImpl loc = new LocatorImpl();
    Location in = xsr.getLocation();
    loc.setSystemId(in.getSystemId());
    loc.setPublicId(in.getPublicId());
    loc.setLineNumber(in.getLineNumber());
    loc.setColumnNumber(in.getColumnNumber());
    return loc;
}
 
Example 18
Source File: AbstractObjectImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public final @NotNull Locator getLocation() {
    LocatorImpl loc = new LocatorImpl();
    loc.setSystemId(systemId);
    loc.setLineNumber(lineNumber);
    return loc;
}
 
Example 19
Source File: AbstractObjectImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public final @NotNull Locator getLocation() {
    LocatorImpl loc = new LocatorImpl();
    loc.setSystemId(systemId);
    loc.setLineNumber(lineNumber);
    return loc;
}
 
Example 20
Source File: AbstractObjectImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public final @NotNull Locator getLocation() {
    LocatorImpl loc = new LocatorImpl();
    loc.setSystemId(systemId);
    loc.setLineNumber(lineNumber);
    return loc;
}