Java 8 Locator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Locator class.

This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
 
      ParseSax<String> parser = createParser();
      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://foohost").build();
      HttpResponse response = HttpResponse.builder().statusCode(304).message("Not Modified").build();
      Locator locator = createMock(Locator.class);
      expect(locator.getColumnNumber()).andReturn(1);
      expect(locator.getLineNumber()).andReturn(1);
      expect(locator.getPublicId()).andReturn("publicId");
      expect(locator.getSystemId()).andReturn("systemId");
      replay(locator);
      Exception input = new SAXParseException("foo", locator);
      verify(locator);
 
      try { 
         parser.setContext(request);
         parser.addDetailsAndPropagate(response, input);
      } catch (RuntimeException e) {
         assertEquals(e.getMessage(), TestUtils.isJava6()
               ? "request: GET http://foohost HTTP/1.1; response: HTTP/1.1 304 Not Modified; error at 1:1 in document systemId; cause: org.xml.sax.SAXParseException: foo" 
               : "request: GET http://foohost HTTP/1.1; response: HTTP/1.1 304 Not Modified; error at 1:1 in document systemId; cause: org.xml.sax.SAXParseExceptionpublicId: publicId; systemId: systemId; lineNumber: 1; columnNumber: 1; foo"); 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
	 *             if the error reporting throws an exception. 
	 */ 
	@Override 
	public void error(SAXParseException e) throws SAXException {
		LOG.severe(
			"Unable to parse xml file.  publicId=(" + documentLocator.getPublicId()
			+ "), systemId=(" + documentLocator.getSystemId()
			+ "), lineNumber=" + documentLocator.getLineNumber()
			+ ", columnNumber=" + documentLocator.getColumnNumber() + ".");
		 
		super.error(e);
	} 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
   * @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());
  } 
   
  /** 
   * Constructor SAXSourceLocator 
   * 
   * 
   * @param locator Source locator 
   */ 
  public SAXSourceLocator(javax.xml.transform.SourceLocator locator)
  { 
    m_locator = null;
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getSystemId
     * 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();
        } 
    } 
 
    /** 
     * Set a location associated with the exception. 
     * @param systemId the system id of the FO document which is associated with the exception; 
     *                 may be null. 
     * @param line line number in the FO document which is associated with the exception. 
     * @param column column number in the line which is associated with the exception. 
     */ 
    public void setLocation(String systemId, int line, int column) {
        this.systemId = systemId;
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
            this.columnNumber = -1;
            this.lineNumber = -1;
            this.publicId = null;
            this.systemId = null;
        } else { 
            this.columnNumber = locator.getColumnNumber();
            this.lineNumber = locator.getLineNumber();
            this.publicId = locator.getPublicId();
            this.systemId = locator.getSystemId();
        } 
        if (rowspan > MAX_ROWSPAN) {
            warn("A rowspan attribute has the value " + rowspan
                    + ", which exceeds the magic Gecko limit of " + MAX_ROWSPAN
                    + "."); 
        } 
        if (colspan > MAX_COLSPAN) {
            warn("A colspan attribute has the value " + colspan
                    + ", which exceeds the magic browser limit of " 
                    + MAX_COLSPAN + ".");
        } 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
     
    public TaintableLocatorImpl(Locator locator) { 
        super(locator); 
        this.tainted = false; 
    } 
     
    public void markTainted() { 
        tainted = true; 
    } 
 
    public boolean isTainted() { 
        return tainted; 
    } 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getSystemId
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
    private final int column;
 
    private final int line;
 
    public LocatorImpl(Locator locator) {
        this.systemId = locator.getSystemId();
        this.publicId = locator.getPublicId();
        this.column = locator.getColumnNumber();
        this.line = locator.getLineNumber();
    } 
 
    public int getColumnNumber() { 
        return column;
    } 
 
    public int getLineNumber() { 
        return line;
    } 
 
    public String getPublicId() {
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
    	  inputName = "unknown-source";
    	  publicId = "unknown-source";
    	  endLine = -1;
    	  endColumn = -1;
    	}else { 
        inputName = locator.getSystemId();
        endLine = locator.getLineNumber();
        endColumn = locator.getColumnNumber();
        publicId = locator.getPublicId();
    	} 
    } 
    @Override 
    public String toString() {
        return //"before column " + endColumn + 
        "line " + endLine + " in '"
        + inputName + "'";
    } 
    @Override 
    public String getSystemId() {
        return inputName;
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnNumber, getLineNumber, getPublicId, getSystemId
   * @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());
  } 
   
  /** 
   * Constructor SAXSourceLocator 
   * 
   * 
   * @param locator Source locator 
   */ 
  public SAXSourceLocator(javax.xml.transform.SourceLocator locator)
  { 
    m_locator = null;
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 Locator Questions & Answers:

See Code Examples for Java 8 Locator Methods: