Java Code Examples for javax.xml.transform.TransformerException#getException()

The following examples show how to use javax.xml.transform.TransformerException#getException() . 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: TransformerFactoryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Receive notification of a non-recoverable error.
 * The application must assume that the transformation cannot continue
 * after the Transformer has invoked this method, and should continue
 * (if at all) only to collect addition error messages. In fact,
 * Transformers are free to stop reporting events once this method has
 * been invoked.
 *
 * @param e warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void fatalError(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 2
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Receive notification of a non-recoverable error.
 * The application must assume that the transformation cannot continue
 * after the Transformer has invoked this method, and should continue
 * (if at all) only to collect addition error messages. In fact,
 * Transformers are free to stop reporting events once this method has
 * been invoked.
 *
 * @param e warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void fatalError(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 3
Source File: TransformerImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Receive notification of a non-recoverable error.
 * The application must assume that the transformation cannot continue
 * after the Transformer has invoked this method, and should continue
 * (if at all) only to collect addition error messages. In fact,
 * Transformers are free to stop reporting events once this method has
 * been invoked.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void fatalError(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 4
Source File: TransformerImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Receive notification of a non-recoverable error.
 * The application must assume that the transformation cannot continue
 * after the Transformer has invoked this method, and should continue
 * (if at all) only to collect addition error messages. In fact,
 * Transformers are free to stop reporting events once this method has
 * been invoked.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void fatalError(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 5
Source File: TransformerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Receive notification of a recoverable error.
 * The transformer must continue to provide normal parsing events after
 * invoking this method. It should still be possible for the application
 * to process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void error(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 6
Source File: TransformerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Receive notification of a non-recoverable error.
 * The application must assume that the transformation cannot continue
 * after the Transformer has invoked this method, and should continue
 * (if at all) only to collect addition error messages. In fact,
 * Transformers are free to stop reporting events once this method has
 * been invoked.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void fatalError(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 7
Source File: TransformerImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Receive notification of a non-recoverable error.
 * The application must assume that the transformation cannot continue
 * after the Transformer has invoked this method, and should continue
 * (if at all) only to collect addition error messages. In fact,
 * Transformers are free to stop reporting events once this method has
 * been invoked.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void fatalError(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 8
Source File: TransformerFactoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Receive notification of a recoverable error.
 * The transformer must continue to provide normal parsing events after
 * invoking this method. It should still be possible for the application
 * to process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void error(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 9
Source File: TransformerFactoryImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Receive notification of a recoverable error.
 * The transformer must continue to provide normal parsing events after
 * invoking this method. It should still be possible for the application
 * to process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void error(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
Example 10
Source File: XPathException.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Print the the trace of methods from where the error
 * originated.  This will trace all nested exception
 * objects, as well as this object.
 * @param s The stream where the dump will be sent to.
 */
public void printStackTrace(java.io.PrintStream s)
{

  if (s == null)
    s = System.err;

  try
  {
    super.printStackTrace(s);
  }
  catch (Exception e){}

  Throwable exception = m_exception;

  for (int i = 0; (i < 10) && (null != exception); i++)
  {
    s.println("---------");
    exception.printStackTrace(s);

    if (exception instanceof TransformerException)
    {
      TransformerException se = (TransformerException) exception;
      Throwable prev = exception;

      exception = se.getException();

      if (prev == exception)
        break;
    }
    else
    {
      exception = null;
    }
  }
}
 
Example 11
Source File: TransformerFactoryImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Receive notification of a warning.
 * Transformers can use this method to report conditions that are not
 * errors or fatal errors. The default behaviour is to take no action.
 * After invoking this method, the Transformer must continue with the
 * transformation. It should still be possible for the application to
 * process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (never does in our case).
 */
@Override
public void warning(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                        e.getMessageAndLocation()));
    }
}
 
Example 12
Source File: TransformerImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Receive notification of a warning.
 * Transformers can use this method to report conditions that are not
 * errors or fatal errors. The default behaviour is to take no action.
 * After invoking this method, the Transformer must continue with the
 * transformation. It should still be possible for the application to
 * process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (never does in our case).
 */
@Override
public void warning(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                        e.getMessageAndLocation()));
    }
}
 
Example 13
Source File: TransformerFactoryImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Receive notification of a warning.
 * Transformers can use this method to report conditions that are not
 * errors or fatal errors. The default behaviour is to take no action.
 * After invoking this method, the Transformer must continue with the
 * transformation. It should still be possible for the application to
 * process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (never does in our case).
 */
@Override
public void warning(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                        e.getMessageAndLocation()));
    }
}
 
Example 14
Source File: XPathException.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the most contained message.
 *
 * @return The error message of the originating exception.
 */
public String getMessage()
{

  String lastMessage = super.getMessage();
  Throwable exception = m_exception;

  while (null != exception)
  {
    String nextMessage = exception.getMessage();

    if (null != nextMessage)
      lastMessage = nextMessage;

    if (exception instanceof TransformerException)
    {
      TransformerException se = (TransformerException) exception;
      Throwable prev = exception;

      exception = se.getException();

      if (prev == exception)
        break;
    }
    else
    {
      exception = null;
    }
  }

  return (null != lastMessage) ? lastMessage : "";
}
 
Example 15
Source File: XPathException.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Print the the trace of methods from where the error
 * originated.  This will trace all nested exception
 * objects, as well as this object.
 * @param s The stream where the dump will be sent to.
 */
public void printStackTrace(java.io.PrintStream s)
{

  if (s == null)
    s = System.err;

  try
  {
    super.printStackTrace(s);
  }
  catch (Exception e){}

  Throwable exception = m_exception;

  for (int i = 0; (i < 10) && (null != exception); i++)
  {
    s.println("---------");
    exception.printStackTrace(s);

    if (exception instanceof TransformerException)
    {
      TransformerException se = (TransformerException) exception;
      Throwable prev = exception;

      exception = se.getException();

      if (prev == exception)
        break;
    }
    else
    {
      exception = null;
    }
  }
}
 
Example 16
Source File: XPathException.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Print the the trace of methods from where the error
 * originated.  This will trace all nested exception
 * objects, as well as this object.
 * @param s The stream where the dump will be sent to.
 */
public void printStackTrace(java.io.PrintStream s)
{

  if (s == null)
    s = System.err;

  try
  {
    super.printStackTrace(s);
  }
  catch (Exception e){}

  Throwable exception = m_exception;

  for (int i = 0; (i < 10) && (null != exception); i++)
  {
    s.println("---------");
    exception.printStackTrace(s);

    if (exception instanceof TransformerException)
    {
      TransformerException se = (TransformerException) exception;
      Throwable prev = exception;

      exception = se.getException();

      if (prev == exception)
        break;
    }
    else
    {
      exception = null;
    }
  }
}
 
Example 17
Source File: TransformerFactoryImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Receive notification of a warning.
 * Transformers can use this method to report conditions that are not
 * errors or fatal errors. The default behaviour is to take no action.
 * After invoking this method, the Transformer must continue with the
 * transformation. It should still be possible for the application to
 * process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (never does in our case).
 */
@Override
public void warning(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                        e.getMessageAndLocation()));
    }
}
 
Example 18
Source File: XPathException.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find the most contained message.
 *
 * @return The error message of the originating exception.
 */
public String getMessage()
{

  String lastMessage = super.getMessage();
  Throwable exception = m_exception;

  while (null != exception)
  {
    String nextMessage = exception.getMessage();

    if (null != nextMessage)
      lastMessage = nextMessage;

    if (exception instanceof TransformerException)
    {
      TransformerException se = (TransformerException) exception;
      Throwable prev = exception;

      exception = se.getException();

      if (prev == exception)
        break;
    }
    else
    {
      exception = null;
    }
  }

  return (null != lastMessage) ? lastMessage : "";
}
 
Example 19
Source File: TransformerFactoryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Receive notification of a warning.
 * Transformers can use this method to report conditions that are not
 * errors or fatal errors. The default behaviour is to take no action.
 * After invoking this method, the Transformer must continue with the
 * transformation. It should still be possible for the application to
 * process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (never does in our case).
 */
@Override
public void warning(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                        e.getMessageAndLocation()));
    }
}
 
Example 20
Source File: TransformerImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Receive notification of a warning.
 * Transformers can use this method to report conditions that are not
 * errors or fatal errors. The default behaviour is to take no action.
 * After invoking this method, the Transformer must continue with the
 * transformation. It should still be possible for the application to
 * process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (never does in our case).
 */
@Override
public void warning(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                        e.getMessageAndLocation()));
    }
}