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

How to use
initCause
method
in
java.lang.IllegalStateException

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

origin: org.netbeans.api/org-openide-util

private void ensureValid(SharedClassObject obj)
throws IllegalStateException {
  if (invalid != null) {
    String msg;
    if (obj != null) {
      msg = obj.toString();
    } else {
      msg = "<unknown object>"; // NOI18N
    }
    throw (IllegalStateException) new IllegalStateException(msg).initCause(invalid);
  }
   // else fine
}
origin: spotbugs/spotbugs

@Override
public synchronized Object setProperty(String key, String value) {
  if (propertReadAt.containsKey(key) && !value.equals(super.getProperty(key))) {
    IllegalStateException e = new IllegalStateException("Changing property '" + key + "' to '" + value
        + "' after it has already been read as '" + super.getProperty(key) + "'");
    e.initCause(propertReadAt.get(key));
    throw e;
  }
  return super.setProperty(key, value);
}
origin: FudanNLP/fnlp

public String getEncoding() {
 if (!isInited) {
   try {
    init();
   } catch (IOException ex) {
    IllegalStateException ise = new IllegalStateException("Init method failed.");
    ise.initCause(ise);
    throw ise;
   }
 }
 return encoding;
}
origin: apache/activemq

  @Override
  public void release() {
    try {
      tx.rollback();
    } catch (IOException unexpected) {
      IllegalStateException e = new IllegalStateException(unexpected);
      e.initCause(unexpected);
      throw e;
    }
  }
}
origin: spotbugs/spotbugs

private <Analysis> Analysis getMethodAnalysisNoException(Class<Analysis> analysisClass, Method method) {
  try {
    return getMethodAnalysis(analysisClass, method);
  } catch (CheckedAnalysisException e) {
    IllegalStateException ise = new IllegalStateException("should not happen");
    ise.initCause(e);
    throw ise;
  }
}
origin: spotbugs/spotbugs

private <Analysis> Analysis getMethodAnalysisNoDataflowAnalysisException(Class<Analysis> analysisClass, Method method)
    throws CFGBuilderException {
  try {
    return getMethodAnalysis(analysisClass, method);
  } catch (CFGBuilderException e) {
    throw e;
  } catch (CheckedAnalysisException e) {
    IllegalStateException ise = new IllegalStateException("should not happen");
    ise.initCause(e);
    throw ise;
  }
}
origin: apache/geode

/**
 * Returns the {@linkplain InetAddress#getCanonicalHostName canonical name} of the local machine.
 */
protected static String getLocalHostName() {
 try {
  return SocketCreator.getLocalHost().getCanonicalHostName();
 } catch (UnknownHostException ex) {
  IllegalStateException ex2 = new IllegalStateException(
    "Could not determine localhost?!");
  ex2.initCause(ex);
  throw ex2;
 }
}
origin: spotbugs/spotbugs

private <Analysis> Analysis getClassAnalysisNoException(Class<Analysis> analysisClass) {
  try {
    return getClassAnalysis(analysisClass);
  } catch (CheckedAnalysisException e) {
    IllegalStateException ise = new IllegalStateException("should not happen");
    ise.initCause(e);
    throw ise;
  }
}
origin: apache/activemq

@Override
public void remove() {
  try {
    synchronized (indexLock) {
      tx.execute(new Transaction.Closure<IOException>() {
        @Override
        public void execute(Transaction tx) throws IOException {
          iterator.remove();
        }
      });
    }
  } catch (IOException unexpected) {
    IllegalStateException e = new IllegalStateException(unexpected);
    e.initCause(unexpected);
    throw e;
  }
}
origin: org.netbeans.api/org-openide-util

private void tryToInitialize(SharedClassObject obj)
throws IllegalStateException {
  initializeInProgress = true;
  obj.initializeSuper = false;
  try {
    obj.initialize();
  } catch (Exception e) {
    invalid = e;
    throw (IllegalStateException) new IllegalStateException(invalid.toString() + " from " + obj).initCause(invalid); // NOI18N
  } catch (LinkageError e) {
    invalid = e;
    throw (IllegalStateException) new IllegalStateException(invalid.toString() + " from " + obj).initCause(invalid); // NOI18N
  } finally {
    initializeInProgress = false;
  }
  if (!obj.initializeSuper) {
    String msg = "You must call super.initialize() from " + obj.getClass().getName() + ".initialize()"; // NOI18N
    err.warning(msg);
  }
}
origin: spotbugs/spotbugs

@Override
public <E> void eagerlyPutMethodAnalysis(Class<E> analysisClass, @Nonnull MethodDescriptor methodDescriptor, E analysisObject) {
  try {
    ClassContext classContext = getClassAnalysis(ClassContext.class, methodDescriptor.getClassDescriptor());
    assert analysisClass.isInstance(analysisObject);
    classContext.putMethodAnalysis(analysisClass, methodDescriptor, analysisObject);
  } catch (CheckedAnalysisException e) {
    IllegalStateException ise = new IllegalStateException("Unexpected exception adding method analysis to cache");
    ise.initCause(e);
    throw ise;
  }
}
origin: spotbugs/spotbugs

@Override
public void purgeMethodAnalyses(@Nonnull MethodDescriptor methodDescriptor) {
  try {
    ClassContext classContext = getClassAnalysis(ClassContext.class, methodDescriptor.getClassDescriptor());
    classContext.purgeMethodAnalyses(methodDescriptor);
  } catch (CheckedAnalysisException e) {
    IllegalStateException ise = new IllegalStateException("Unexpected exception purging method analyses from cache");
    ise.initCause(e);
    throw ise;
  }
}
origin: spotbugs/spotbugs

private <Analysis> Analysis getMethodAnalysis(Class<Analysis> analysisClass, Method method) throws DataflowAnalysisException,
CFGBuilderException {
  try {
    MethodDescriptor methodDescriptor = BCELUtil.getMethodDescriptor(jclass, method);
    return Global.getAnalysisCache().getMethodAnalysis(analysisClass, methodDescriptor);
  } catch (DataflowAnalysisException e) {
    throw e;
  } catch (CFGBuilderException e) {
    throw e;
  } catch (CheckedAnalysisException e) {
    Throwable cause = e.getCause();
    if (cause instanceof CFGBuilderException) {
      throw (CFGBuilderException) cause;
    }
    String message = "Should not happen: bad CAE: " + e.getClass().getName() + " for " + analysisClass.getName() + " of " + method;
    IllegalStateException ise = new IllegalStateException(message);
    ise.initCause(e);
    throw ise;
  }
}
origin: liuyangming/ByteTCC

public void afterReceiveRequest(TransactionRequest request) throws IllegalStateException {
  TransactionContext srcTransactionContext = request.getTransactionContext();
  if (srcTransactionContext == null) {
    return;
  }
  TransactionParticipant compensableCoordinator = this.beanFactory.getCompensableNativeParticipant();
  TransactionContext transactionContext = srcTransactionContext.clone();
  transactionContext.setPropagatedBy(srcTransactionContext.getPropagatedBy());
  try {
    compensableCoordinator.start(transactionContext, XAResource.TMNOFLAGS);
  } catch (XAException ex) {
    logger.error("CompensableInterceptorImpl.afterReceiveRequest({})", request, ex);
    IllegalStateException exception = new IllegalStateException();
    exception.initCause(ex);
    throw exception;
  }
}
origin: org.netbeans.api/org-openide-util

ex.initCause(anEx);
Exceptions.attachLocalizedMessage(ex, "Cannot createClone for " + this); // NOI18N
origin: line/armeria

  @Override
  public void unaryCall(SimpleRequest request, StreamObserver<SimpleResponse> responseObserver) {
    IllegalStateException e1 = new IllegalStateException("Exception 1");
    IllegalArgumentException e2 = new IllegalArgumentException();
    AssertionError e3 = new AssertionError("Exception 3");
    Exceptions.clearTrace(e3);
    RuntimeException e4 = new RuntimeException("Exception 4");
    e1.initCause(e2);
    e2.initCause(e3);
    e3.initCause(e4);
    Status status = Status.ABORTED.withCause(e1);
    responseObserver.onError(status.asRuntimeException());
  }
}
origin: spotbugs/spotbugs

/**
 * Get the ClassContext for a class.
 *
 * @param javaClass
 *            the class
 * @return the ClassContext for that class
 */
public ClassContext getClassContext(JavaClass javaClass) {
  // This is a bit silly since we're doing an unnecessary
  // ClassDescriptor->JavaClass lookup.
  // However, we can be assured that it will succeed.
  ClassDescriptor classDescriptor = DescriptorFactory.instance().getClassDescriptor(
      ClassName.toSlashedClassName(javaClass.getClassName()));
  try {
    return Global.getAnalysisCache().getClassAnalysis(ClassContext.class, classDescriptor);
  } catch (CheckedAnalysisException e) {
    IllegalStateException ise = new IllegalStateException("Could not get ClassContext for JavaClass");
    ise.initCause(e);
    throw ise;
  }
}
origin: liuyangming/ByteTCC

case XAException.XAER_NOTA:
  IllegalStateException stateEx = new IllegalStateException();
  stateEx.initCause(xaex);
  throw stateEx;
case XAException.XAER_INVAL:
  IllegalStateException error = new IllegalStateException();
  error.initCause(xaex);
  throw error;
case XAException.XAER_RMERR:
origin: liuyangming/ByteTCC

public void beforeSendResponse(TransactionResponse response) throws IllegalStateException {
  CompensableManager compensableManager = this.beanFactory.getCompensableManager();
  CompensableTransaction transaction = compensableManager.getCompensableTransactionQuietly();
  if (transaction == null) {
    return;
  }
  TransactionParticipant compensableCoordinator = this.beanFactory.getCompensableNativeParticipant();
  TransactionContext srcTransactionContext = transaction.getTransactionContext();
  TransactionContext transactionContext = srcTransactionContext.clone();
  transactionContext.setPropagatedBy(srcTransactionContext.getPropagatedBy());
  response.setTransactionContext(transactionContext);
  try {
    compensableCoordinator.end(transactionContext, XAResource.TMSUCCESS);
  } catch (XAException ex) {
    logger.error("CompensableInterceptorImpl.beforeSendResponse({})", response, ex);
    IllegalStateException exception = new IllegalStateException();
    exception.initCause(ex);
    throw exception;
  }
}
origin: apache/activemq

} catch (Exception e) {
  IllegalStateException ise = new IllegalStateException("Could not configure WireFormatInfo");
  ise.initCause(e);
  throw ise;
java.langIllegalStateExceptioninitCause

Popular methods of IllegalStateException

  • <init>
    Constructs a new IllegalStateException with the current stack trace and the specified cause.
  • getMessage
  • printStackTrace
  • getStackTrace
  • setStackTrace
  • getCause
  • toString
  • addSuppressed
  • getLocalizedMessage
  • fillInStackTrace
  • getSuppressed
  • getSuppressed

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • getSystemService (Context)
  • compareTo (BigDecimal)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • BoxLayout (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Top Vim plugins
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