Java 8 SAXParseException - 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 SAXParseException class.

This code example shows how to use the following methods: getColumnNumber, getLineNumber, getPublicId, getSystemId
            } 
 
            mySink.complete();
 
        } catch (SAXParseException e) {
            throw new OsmosisRuntimeException( 
                    "Unable to parse xml" 
                    + ".  publicId=(" + e.getPublicId()
                    + "), systemId=(" + e.getSystemId()
                    + "), lineNumber=" + e.getLineNumber()
                    + ", columnNumber=" + e.getColumnNumber() + ".",
                    e);
        } catch (SAXException e) {
            throw new OsmosisRuntimeException("Unable to parse XML.", e);
        } catch (IOException e) {
            throw new OsmosisRuntimeException("Unable to read XML.", e);
        } finally { 
            mySink.release();
 
            cleanup(); 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMessage, getColumnNumber, getLineNumber, getSystemId
 
  // ErrorHandler 
 
  @Override 
  public void warning(SAXParseException e) {
    log.warn("XML parse warning in \""+e.getSystemId()+"\", line "+e.getLineNumber()+", column "+e.getColumnNumber()+": "+e.getMessage());
  } 
 
  @Override 
  public void error(SAXParseException e) throws SAXException {
    throw e;
  } 
 
  @Override 
  public void fatalError(SAXParseException e) throws SAXException {
    throw e;
  } 
 
  // ErrorListener 
 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMessage, getColumnNumber, getLineNumber, getPublicId, getSystemId
     * @param ex  PARAM 
     * @return    Returns 
     */ 
    public String print( SAXParseException ex ) {
        StringBuffer sb = new StringBuffer();
        sb.append( "Exception: " + ex.getMessage() );
        sb.append( "failed at column : " + ex.getColumnNumber() +
                " on line " + ex.getLineNumber() );
        sb.append( "entity:\n" + ex.getPublicId() + "\n" + ex.getSystemId() );
        return sb.toString();
    } 
 
    /** 
     * Sets the textArea attribute of the ValidationHandler object 
     * 
     * @param jta  The new textArea value 
     */ 
    public void setTextArea( JTextArea jta ) {
        this.jta = jta;
    } 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getException, getMessage, getColumnNumber, getLineNumber, getPublicId
This code example shows how to use the following methods: getMessage, getLineNumber, getSystemId, toString
      xr.setDTDHandler(null);
      xr.parse(new InputSource(fileReader));
      visitor.close(null);
    } catch (SAXParseException e) {
      System.out.println("XML parsing error: " + "\n" +
          "Line:    " + e.getLineNumber() + "\n" +
          "URI:     " + e.getSystemId() + "\n" +
          "Message: " + e.getMessage());        
      visitor.close(e);
      throw new IOException(e.toString());
    } catch (SAXException e) {
      visitor.close(e);
      throw new IOException(e.toString());
    } catch (RuntimeException e) {
      visitor.close(e);
      throw e;
    } finally { 
      fileReader.close();
    } 
  } 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMessage, getLineNumber, getSystemId, toString
      xr.setDTDHandler(null);
      xr.parse(new InputSource(fileReader));
      visitor.close(null);
    } catch (SAXParseException e) {
      System.out.println("XML parsing error: " + "\n" +
          "Line:    " + e.getLineNumber() + "\n" +
          "URI:     " + e.getSystemId() + "\n" +
          "Message: " + e.getMessage());        
      visitor.close(e);
      throw new IOException(e.toString());
    } catch (SAXException e) {
      visitor.close(e);
      throw new IOException(e.toString());
    } catch (RuntimeException e) {
      visitor.close(e);
      throw e;
    } finally { 
      fileReader.close();
    } 
  } 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getColumnNumber, getLineNumber, getPublicId, getSystemId
   * 
   * @param spe SAXParseException exception. 
   */ 
  public SAXSourceLocator(SAXParseException spe)
  { 
    this.setLineNumber( spe.getLineNumber() );
    this.setColumnNumber( spe.getColumnNumber() );
    this.setPublicId( spe.getPublicId() );
    this.setSystemId( spe.getSystemId() );
  } 
   
  /** 
   * Return the public identifier for the current document event. 
   * 
   * <p>The return value is the public identifier of the document 
   * entity or of the external parsed entity in which the markup 
   * triggering the event appears.</p> 
   * 
   * @return A string containing the public identifier, or 
   *         null if none is available. 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getColumnNumber, getLineNumber, getSystemId
   * Returns a string of the location. 
   */ 
  private String getLocationString(SAXParseException ex) {
    StringBuilder str = new StringBuilder();
 
    String systemId = ex.getSystemId();
    if (systemId != null) {
      int index = systemId.lastIndexOf('/');
      if (index != -1) {
        systemId = systemId.substring(index + 1);
      } 
      str.append(systemId);
    } 
    str.append(':');
    str.append(ex.getLineNumber());
    str.append(':');
    str.append(ex.getColumnNumber());
 
    return str.toString();
 

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getColumnNumber, getLineNumber, getPublicId, getSystemId
 
    @Override 
    public void error(SAXParseException x) throws SAXException {
        if (loggable) {
            final String msg = "[ERROR] - Unexpected exception while parsing "
                    + "an instance of PUBLIC [" + x.getPublicId()
                    + "], SYSTEM [" + x.getSystemId() + "] - line #"
                    + x.getLineNumber() + ", column #" + x.getColumnNumber();
            if (debug) {
                Context.getCurrentLogger().log(Level.CONFIG, msg, x);
            } else { 
                logger.config(msg + ": " + x.getLocalizedMessage());
            } 
        } 
    } 
 
    @Override 
    public void fatalError(SAXParseException x) throws SAXException {
        if (loggable) {
            final String msg = "[FATAL] - Unexpected exception while parsing "
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
      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"); 
         assertEquals(e.getCause(), input);
      } 
   } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 SAXParseException Methods: