org.apache.xml.utils.WrappedRuntimeException Java Examples

The following examples show how to use org.apache.xml.utils.WrappedRuntimeException. 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: RedundentExprEliminator.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new WalkingIterator from the steps in another WalkingIterator.
 * 
 * @param wi The iterator from where the steps will be taken.
 * @param numSteps The number of steps from the first to copy into the new 
 *                 iterator.
 * @return The new iterator.
 */
protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps)
{
	WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver());
	try
	{
		AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone();
		newIter.setFirstWalker(walker);
		walker.setLocPathIterator(newIter);
		for(int i = 1; i < numSteps; i++)
		{
			AxesWalker next = (AxesWalker)walker.getNextWalker().clone();
			walker.setNextWalker(next);
			next.setLocPathIterator(newIter);
			walker = next;
		}
		walker.setNextWalker(null);
	}
	catch(CloneNotSupportedException cnse)
	{
		throw new WrappedRuntimeException(cnse);
	}
	return newIter;
}
 
Example #2
Source File: IteratorPool.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * Get an instance of the given object in this pool 
 *
 * @return An instance of the given object
 */
public synchronized DTMIterator getInstance()
{
  // Check if the pool is empty.
  if (m_freeStack.isEmpty())
  {

    // Create a new object if so.
    try
    {
      return (DTMIterator)m_orig.clone();
    }
    catch (Exception ex)
    {
      throw new WrappedRuntimeException(ex);
    }
  }
  else
  {
    // Remove object from end of free pool.
    DTMIterator result = (DTMIterator)m_freeStack.remove(m_freeStack.size() - 1);
    return result;
  }
}
 
Example #3
Source File: MCRErrorListener.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
public static TransformerException unwrapException(TransformerException exception) {
    Throwable cause = exception.getCause();
    while (cause != null) {
        if (cause instanceof TransformerException) {
            return unwrapException((TransformerException) cause);
        }
        if (cause instanceof WrappedRuntimeException) {
            cause = ((WrappedRuntimeException) cause).getException();
        } else {
            cause = cause.getCause();
        }
    }
    return exception;
}
 
Example #4
Source File: MCRExceptionCauseFinder.java    From mycore with GNU General Public License v3.0 4 votes vote down vote up
public static Exception getCause(WrappedRuntimeException ex) {
    return getCause(ex.getException());
}
 
Example #5
Source File: MCRTemplatesCompiler.java    From mycore with GNU General Public License v3.0 4 votes vote down vote up
public void error(TransformerException ex) {
    throw new WrappedRuntimeException(MCRExceptionCauseFinder.getCause(ex));
}
 
Example #6
Source File: MCRTemplatesCompiler.java    From mycore with GNU General Public License v3.0 4 votes vote down vote up
public void fatalError(TransformerException ex) {
    throw new WrappedRuntimeException(MCRExceptionCauseFinder.getCause(ex));
}
 
Example #7
Source File: SAX2DTM.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * This method should try and build one or more nodes in the table.
 *
 * @return The true if a next node is found or false if
 *         there are no more nodes.
 */
protected boolean nextNode()
{

  if (null == m_incrementalSAXSource)
    return false;

  if (m_endDocumentOccured)
  {
    clearCoRoutine();

    return false;
  }

  Object gotMore = m_incrementalSAXSource.deliverMoreNodes(true);

  // gotMore may be a Boolean (TRUE if still parsing, FALSE if
  // EOF) or an exception if IncrementalSAXSource malfunctioned
  // (code error rather than user error).
  //
  // %REVIEW% Currently the ErrorHandlers sketched herein are
  // no-ops, so I'm going to initially leave this also as a
  // no-op.
  if (!(gotMore instanceof Boolean))
  {
    if(gotMore instanceof RuntimeException)
    {
      throw (RuntimeException)gotMore;
    }
    else if(gotMore instanceof Exception)
    {
      throw new WrappedRuntimeException((Exception)gotMore);
    }
    // for now...
    clearCoRoutine();

    return false;

    // %TBD%
  }

  if (gotMore != Boolean.TRUE)
  {

    // EOF reached without satisfying the request
    clearCoRoutine();  // Drop connection, stop trying

    // %TBD% deregister as its listener?
  }

  return true;
}