/** Returns the cause of this <code>XNIException</code>. */ public Throwable getCause() { return getException(); } // getCause():Throwable
/** * Converts the {@link XNIException} received from a downstream * component to a {@link SAXException}. */ private SAXException toSAXException( XNIException xe ) { Exception e = xe.getException(); if( e==null ) e = xe; if( e instanceof SAXException ) return (SAXException)e; return new SAXException(e); }
/** * Extract nested exception within an XNIException (Nekohtml uses reflection and generated * exceptions are wrapped many times within XNIException and InvocationTargetException) * * @param e the original XNIException * @return the cause exception */ static Throwable extractNestedException(final Throwable e) { Throwable originalException = e; Throwable cause = ((XNIException) e).getException(); while (cause != null) { originalException = cause; if (cause instanceof XNIException) { cause = ((XNIException) cause).getException(); } else if (cause instanceof InvocationTargetException) { cause = cause.getCause(); } else { cause = null; } } return originalException; }
/** * Extract nested exception within an XNIException (Nekohtml uses reflection and generated * exceptions are wrapped many times within XNIException and InvocationTargetException) * * @param e the original XNIException * @return the cause exception */ static Throwable extractNestedException(final Throwable e) { Throwable originalException = e; Throwable cause = ((XNIException) e).getException(); while (cause != null) { originalException = cause; if (cause instanceof XNIException) { cause = ((XNIException) cause).getException(); } else if (cause instanceof InvocationTargetException) { cause = cause.getCause(); } else { cause = null; } } return originalException; }
/** * Extract nested exception within an XNIException (Nekohtml uses reflection and generated * exceptions are wrapped many times within XNIException and InvocationTargetException) * * @param e the original XNIException * @return the cause exception */ static Throwable extractNestedException(final Throwable e) { Throwable originalException = e; Throwable cause = ((XNIException) e).getException(); while (cause != null) { originalException = cause; if (cause instanceof XNIException) { cause = ((XNIException) cause).getException(); } else if (cause instanceof InvocationTargetException) { cause = cause.getCause(); } else { cause = null; } } return originalException; }
/** * Extract nested exception within an XNIException (Nekohtml uses reflection and generated * exceptions are wrapped many times within XNIException and InvocationTargetException) * * @param e the original XNIException * @return the cause exception */ static Throwable extractNestedException(final Throwable e) { Throwable originalException = e; Throwable cause = ((XNIException) e).getException(); while (cause != null) { originalException = cause; if (cause instanceof XNIException) { cause = ((XNIException) cause).getException(); } else if (cause instanceof InvocationTargetException) { cause = cause.getCause(); } else { cause = null; } } return originalException; }
/** * Extract nested exception within an XNIException (Nekohtml uses reflection and generated * exceptions are wrapped many times within XNIException and InvocationTargetException) * * @param e the original XNIException * @return the cause exception */ static Throwable extractNestedException(final Throwable e) { Throwable originalException = e; Throwable cause = ((XNIException) e).getException(); while (cause != null) { originalException = cause; if (cause instanceof XNIException) { cause = ((XNIException) cause).getException(); } else if (cause instanceof InvocationTargetException) { cause = cause.getCause(); } else { cause = null; } } return originalException; }
/** * Reconstructs {@link SAXException} from XNIException. */ public static SAXException toSAXException(XNIException e) { if(e instanceof XMLParseException) return toSAXParseException((XMLParseException)e); if( e.getException() instanceof SAXException ) return (SAXException)e.getException(); return new SAXException(e.getMessage(),e.getException()); }
static void convertToSAXException(XNIException e) throws SAXException { Exception ex = e.getException(); if (ex == null) { throw new SAXException(e.getMessage()); } if (ex instanceof SAXException) { throw (SAXException) ex; } throw new SAXException(ex); }
static SAXException toSAXException(XNIException e) { if (e instanceof XMLParseException) { XMLParseException pe = (XMLParseException)e; return new SAXParseException(pe.getMessage(), pe.getPublicId(), pe.getExpandedSystemId(), pe.getLineNumber(), pe.getColumnNumber(), pe.getException()); } Exception nested = e.getException(); if (nested == null) return new SAXException(e.getMessage()); if (nested instanceof SAXException) return (SAXException)nested; if (nested instanceof RuntimeException) throw (RuntimeException)nested; return new SAXException(nested); } }
Exception ex = e.getException(); throw ex;
static SAXException toSAXException(XNIException e) { if (e instanceof XMLParseException) { XMLParseException pe = (XMLParseException)e; return new SAXParseException(pe.getMessage(), pe.getPublicId(), pe.getExpandedSystemId(), pe.getLineNumber(), pe.getColumnNumber(), pe.getException()); } Exception nested = e.getException(); if (nested == null) return new SAXException(e.getMessage()); if (nested instanceof SAXException) return (SAXException)nested; if (nested instanceof RuntimeException) throw (RuntimeException)nested; return new SAXException(nested); } }
Exception ex = e.getException(); if (ex == null) { throw new SAXException(e.getMessage());
Exception ex = e.getException(); if (ex == null) { throw new SAXException(e.getMessage());
Exception ex = e.getException(); if (ex == null) { throw new SAXException(e.getMessage());
Exception ex = e.getException(); if (ex == null) { throw new SAXException(e.getMessage());