Tabnine Logo
RuntimeException.initCause
Code IndexAdd Tabnine to your IDE (free)

How to use
initCause
method
in
java.lang.RuntimeException

Best Java code snippets using java.lang.RuntimeException.initCause (Showing top 20 results out of 1,350)

origin: org.osgi/org.osgi.compendium

  /**
   * Initializes the cause of this exception to the specified value.
   * 
   * @param cause The cause of this exception.
   * @return This exception.
   * @throws IllegalArgumentException If the specified cause is this
   *         exception.
   * @throws IllegalStateException If the cause of this exception has already
   *         been set.
   */
  public Throwable initCause(Throwable cause) {
    return super.initCause(cause);
  }
}
origin: BroadleafCommerce/BroadleafCommerce

public UnknownUnwrapTypeException(Class unwrapType, Throwable root) {
  this( unwrapType );
  super.initCause( root );
}
origin: spotbugs/spotbugs

public String firstLine(BufferedReader r) {
  try {
    return r.readLine();
  } catch (IOException e) {
    throw (RuntimeException) new RuntimeException("IO Error").initCause(e);
  }
}
origin: apache/geode

/**
 * Generates XML and writes it to the given <code>PrintWriter</code>
 */
private void generate(PrintWriter pw) {
 // Use JAXP's transformation API to turn SAX events into pretty
 // XML text
 try {
  Source src = new SAXSource(this, new InputSource());
  Result res = new StreamResult(pw);
  TransformerFactory xFactory = TransformerFactory.newInstance();
  Transformer xform = xFactory.newTransformer();
  xform.setOutputProperty(OutputKeys.METHOD, "xml");
  xform.setOutputProperty(OutputKeys.INDENT, "yes");
  xform.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, SYSTEM_ID);
  xform.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, PUBLIC_ID);
  xform.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
  xform.transform(src, res);
  pw.flush();
 } catch (Exception ex) {
  RuntimeException ex2 = new RuntimeException(
    "Exception thrown while generating XML.");
  ex2.initCause(ex);
  throw ex2;
 }
}
origin: robolectric/robolectric

private static <T> T getFuture(final String comment, final Future<T> future) {
 try {
  return Uninterruptibles.getUninterruptibly(future);
  // No need to catch cancellationexception - we never cancel these futures
 } catch (ExecutionException e) {
  Throwable t = e.getCause();
  if (t instanceof SQLiteException) {
   final RuntimeException sqlException = getSqliteException("Cannot " + comment, ((SQLiteException) t).getBaseErrorCode());
   sqlException.initCause(e);
   throw sqlException;
  } else {
   throw new RuntimeException(e);
  }
 }
}
origin: apache/geode

/**
 * Writes the generator's state to pw
 */
private void generate(PrintWriter pw) {
 // Use JAXP's transformation API to turn SAX events into pretty
 // XML text
 try {
  Source src = new SAXSource(this, new InputSource());
  Result res = new StreamResult(pw);
  TransformerFactory xFactory = TransformerFactory.newInstance();
  Transformer xform = xFactory.newTransformer();
  xform.setOutputProperty(OutputKeys.METHOD, "xml");
  xform.setOutputProperty(OutputKeys.INDENT, "yes");
  if (!useSchema) {
   // set the doctype system and public ids from version for older DTDs.
   xform.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, version.getSystemId());
   xform.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, version.getPublicId());
  }
  xform.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
  xform.transform(src, res);
  pw.flush();
 } catch (Exception ex) {
  RuntimeException ex2 = new RuntimeException(
    "An Exception was thrown while generating XML.");
  ex2.initCause(ex);
  throw ex2;
 }
}
origin: com.h2database/h2

    ", but in the past before";
RuntimeException ex = new RuntimeException(message);
ex.initCause(e);
ex.printStackTrace(System.out);
origin: apache/ignite

/** {@inheritDoc} */
@Override public T get() throws ExecutionException {
  try {
    T res = fut.get();
    if (fut.isCancelled())
      throw new CancellationException("Task was cancelled: " + fut);
    return res;
  }
  catch (IgniteCheckedException e) {
    // Task cancellation may cause throwing exception.
    if (fut.isCancelled()) {
      RuntimeException ex = new CancellationException("Task was cancelled: " + fut);
      ex.initCause(e);
      throw ex;
    }
    throw new ExecutionException("Failed to get task result: " + fut, e);
  }
}
origin: apache/geode

public int calcSerializedSize() {
 NullDataOutputStream dos = new NullDataOutputStream();
 try {
  toData(dos);
  return dos.size();
 } catch (IOException ex) {
  RuntimeException ex2 = new IllegalArgumentException(
    "Could not calculate size of object");
  ex2.initCause(ex);
  throw ex2;
 }
}
origin: knightliao/disconf

  LOG.warn("Caught: " + e, e);
  throw (RuntimeException) new RuntimeException(e.getMessage()).
                                   initCause(e);
} finally {
  if (callback != null) {
origin: apache/zookeeper

LOG.warn("Caught: " + e, e);
throw (RuntimeException) new RuntimeException(e.getMessage()).
  initCause(e);
origin: apache/ignite

  /** {@inheritDoc} */
  @Override public T get(long timeout, TimeUnit unit) throws ExecutionException, TimeoutException {
    A.ensure(timeout >= 0, "timeout >= 0");
    A.notNull(unit, "unit != null");
    try {
      T res = fut.get(unit.toMillis(timeout));
      if (fut.isCancelled())
        throw new CancellationException("Task was cancelled: " + fut);
      return res;
    }
    catch (IgniteFutureTimeoutCheckedException e) {
      TimeoutException e2 = new TimeoutException();
      e2.initCause(e);
      throw e2;
    }
    catch (ComputeTaskTimeoutCheckedException e) {
      throw new ExecutionException("Task execution timed out during waiting for task result: " + fut, e);
    }
    catch (IgniteCheckedException e) {
      // Task cancellation may cause throwing exception.
      if (fut.isCancelled()) {
        RuntimeException ex = new CancellationException("Task was cancelled: " + fut);
        ex.initCause(e);
        throw ex;
      }
      throw new ExecutionException("Failed to get task result.", e);
    }
  }
}
origin: apache/geode

@Override
public boolean containsValueForKey(KeyInfo keyInfo) {
 try {
  boolean retVal = region.containsValueForKeyRemotely(
    (InternalDistributedMember) state.getTarget(), keyInfo.getBucketId(), keyInfo.getKey());
  trackBucketForTx(keyInfo);
  return retVal;
 } catch (TransactionException e) {
  RuntimeException re = getTransactionException(keyInfo, e);
  re.initCause(e.getCause());
  throw re;
 } catch (PrimaryBucketException e) {
  RuntimeException re = getTransactionException(keyInfo, e);
  re.initCause(e);
  throw re;
 } catch (ForceReattemptException e) {
  if (isBucketNotFoundException(e)) {
   RuntimeException re = getTransactionException(keyInfo, e);
   re.initCause(e);
   throw re;
  }
  waitToRetry();
  RuntimeException re = new TransactionDataNodeHasDepartedException(
    String.format(
      "Transaction data node %s has departed. To proceed, rollback this transaction and begin a new one.",
      state.getTarget()));
  re.initCause(e);
  throw re;
 }
}
origin: apache/geode

@Override
public boolean containsKey(KeyInfo keyInfo) {
 try {
  boolean retVal = region.containsKeyRemotely((InternalDistributedMember) state.getTarget(),
    keyInfo.getBucketId(), keyInfo.getKey());
  trackBucketForTx(keyInfo);
  return retVal;
 } catch (TransactionException e) {
  RuntimeException re = getTransactionException(keyInfo, e);
  re.initCause(e.getCause());
  throw re;
 } catch (PrimaryBucketException e) {
  RuntimeException re = getTransactionException(keyInfo, e);
  re.initCause(e);
  throw re;
 } catch (ForceReattemptException e) {
  if (isBucketNotFoundException(e)) {
   RuntimeException re = getTransactionException(keyInfo, e);
   re.initCause(e);
   throw re;
  }
  waitToRetry();
  RuntimeException re = new TransactionDataNodeHasDepartedException(
    String.format(
      "Transaction data node %s has departed. To proceed, rollback this transaction and begin a new one.",
      state.getTarget()));
  re.initCause(e);
  throw re;
 }
}
origin: voldemort/voldemort

  public void run() {
    try {
      servers.add(ServerTestUtils.startVoldemortServer(socketStoreFactory,
                               ServerTestUtils.createServerConfig(useNio,
                                                j,
                                                TestUtils.createTempDir()
                                                     .getAbsolutePath(),
                                                null,
                                                storesXmlfile,
                                                props),
                               cluster));
    } catch(IOException ioe) {
      logger.error("Caught IOException during parallel server start: "
             + ioe.getMessage());
      RuntimeException re = new RuntimeException();
      re.initCause(ioe);
      throw re;
    } finally {
      // Ensure setup progresses in face of errors
      countDownLatch.countDown();
    }
  }
});
origin: apache/geode

@Override
public boolean putEntry(EntryEventImpl event, boolean ifNew, boolean ifOld,
  Object expectedOldValue, boolean requireOldValue, long lastModified,
  boolean overwriteDestroyed) {
 boolean retVal = false;
 final InternalRegion r = event.getRegion();
 PartitionedRegion pr = (PartitionedRegion) r;
 try {
  retVal =
    pr.putRemotely(state.getTarget(), event, ifNew, ifOld, expectedOldValue, requireOldValue);
 } catch (TransactionException e) {
  RuntimeException re = getTransactionException(event.getKeyInfo(), e);
  re.initCause(e.getCause());
  throw re;
 } catch (PrimaryBucketException e) {
  RuntimeException re = getTransactionException(event.getKeyInfo(), e);
  re.initCause(e);
  throw re;
 } catch (ForceReattemptException e) {
  waitToRetry();
  RuntimeException re = getTransactionException(event.getKeyInfo(), e);
  re.initCause(e);
  throw re;
 }
 trackBucketForTx(event.getKeyInfo());
 return retVal;
}
origin: apache/geode

} catch (TransactionException e) {
 RuntimeException re = getTransactionException(event.getKeyInfo(), e);
 re.initCause(e.getCause());
 throw re;
} catch (PrimaryBucketException e) {
 RuntimeException re = getTransactionException(event.getKeyInfo(), e);
 re.initCause(e);
 throw re;
} catch (ForceReattemptException e) {
      state.getTarget()));
 re.initCause(e);
 waitToRetry();
 throw re;
origin: apache/geode

 @Override
 public RuntimeException generateCancelledException(Throwable e) {
  String reason = cancelInProgress();
  if (reason == null) {
   return null;
  }
  DistributionManager dm = getDM();
  if (dm == null) {
   return new DistributedSystemDisconnectedException("no distribution manager");
  }
  RuntimeException result = dm.getCancelCriterion().generateCancelledException(e);
  if (result != null) {
   return result;
  }
  // We know we've been stopped; generate the exception
  result = new DistributedSystemDisconnectedException("Conduit has been stopped");
  result.initCause(e);
  return result;
 }
}
origin: apache/geode

private VersionedObjectList sendMsgByBucket(final Integer bucketId, RemoveAllPRMessage prMsg,
  PartitionedRegion pr) {
 // retry the put remotely until it finds the right node managing the bucket
 InternalDistributedMember currentTarget =
   pr.getOrCreateNodeForBucketWrite(bucketId.intValue(), null);
 if (!currentTarget.equals(this.state.getTarget())) {
  @Released
  EntryEventImpl firstEvent = prMsg.getFirstEvent(pr);
  try {
   throw new TransactionDataNotColocatedException(
     String.format("Key %s is not colocated with transaction",
       firstEvent.getKey()));
  } finally {
   firstEvent.release();
  }
 }
 try {
  return pr.tryToSendOneRemoveAllMessage(prMsg, currentTarget);
 } catch (ForceReattemptException prce) {
  pr.checkReadiness();
  throw new TransactionDataNotColocatedException(prce.getMessage());
 } catch (PrimaryBucketException notPrimary) {
  RuntimeException re = new TransactionDataRebalancedException(
    "Transactional data moved, due to rebalancing.");
  re.initCause(notPrimary);
  throw re;
 } catch (DataLocationException dle) {
  throw new TransactionException(dle);
 }
}
origin: apache/geode

private VersionedObjectList sendMsgByBucket(final Integer bucketId, PutAllPRMessage prMsg,
  PartitionedRegion pr) {
 // retry the put remotely until it finds the right node managing the bucket
 InternalDistributedMember currentTarget =
   pr.getOrCreateNodeForBucketWrite(bucketId.intValue(), null);
 if (!currentTarget.equals(this.state.getTarget())) {
  @Released
  EntryEventImpl firstEvent = prMsg.getFirstEvent(pr);
  try {
   throw new TransactionDataNotColocatedException(
     String.format("Key %s is not colocated with transaction",
       firstEvent.getKey()));
  } finally {
   firstEvent.release();
  }
 }
 try {
  return pr.tryToSendOnePutAllMessage(prMsg, currentTarget);
 } catch (ForceReattemptException prce) {
  pr.checkReadiness();
  throw new TransactionDataNotColocatedException(prce.getMessage());
 } catch (PrimaryBucketException notPrimary) {
  RuntimeException re = new TransactionDataRebalancedException(
    "Transactional data moved, due to rebalancing.");
  re.initCause(notPrimary);
  throw re;
 } catch (DataLocationException dle) {
  throw new TransactionException(dle);
 }
}
java.langRuntimeExceptioninitCause

Popular methods of RuntimeException

  • <init>
  • getMessage
  • printStackTrace
  • getCause
  • toString
  • getStackTrace
  • setStackTrace
  • getLocalizedMessage
  • fillInStackTrace
  • addSuppressed
  • getSuppressed
  • getSuppressed

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getContentResolver (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • JPanel (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now