本文整理了Java中java.lang.IllegalStateException.printStackTrace()
方法的一些代码示例,展示了IllegalStateException.printStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IllegalStateException.printStackTrace()
方法的具体详情如下:
包路径:java.lang.IllegalStateException
类名称:IllegalStateException
方法名:printStackTrace
暂无
代码示例来源:origin: reactive-streams/reactive-streams-jvm
@Override public void onComplete() {
if (subscription == null) { // Technically this check is not needed, since we are expecting Publishers to conform to the spec
(new IllegalStateException("Publisher violated the Reactive Streams rule 1.09 signalling onComplete prior to onSubscribe.")).printStackTrace(System.err);
} else {
// Here we are not allowed to call any methods on the `Subscription` or the `Publisher`, as per rule 2.3
// And anyway, the `Subscription` is considered to be cancelled if this method gets called, as per rule 2.4
}
}
}
代码示例来源:origin: reactive-streams/reactive-streams-jvm
@Override public void onError(final Throwable t) {
if (subscription == null) { // Technically this check is not needed, since we are expecting Publishers to conform to the spec
(new IllegalStateException("Publisher violated the Reactive Streams rule 1.09 signalling onError prior to onSubscribe.")).printStackTrace(System.err);
} else {
// As per rule 2.13, we need to throw a `java.lang.NullPointerException` if the `Throwable` is `null`
if (t == null) throw null;
// Here we are not allowed to call any methods on the `Subscription` or the `Publisher`, as per rule 2.3
// And anyway, the `Subscription` is considered to be cancelled if this method gets called, as per rule 2.4
}
}
代码示例来源:origin: libgdx/libgdx
public void setPosition (float position) {
if (player == null) return;
try {
if (!isPrepared) {
player.prepare();
isPrepared = true;
}
player.seekTo((int)(position * 1000));
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: libgdx/libgdx
public void setPosition (float position) {
if (player == null) return;
try {
if (!isPrepared) {
player.prepare();
isPrepared = true;
}
player.seekTo((int)(position * 1000));
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void play () {
if (player == null) return;
try {
if (player.isPlaying()) return;
} catch (Exception e) {
// NOTE: isPlaying() can potentially throw an exception and crash the application
e.printStackTrace();
return;
}
try {
if (!isPrepared) {
player.prepare();
isPrepared = true;
}
player.start();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void play () {
if (player == null) return;
try {
if (player.isPlaying()) return;
} catch (Exception e) {
// NOTE: isPlaying() can potentially throw an exception and crash the application
e.printStackTrace();
return;
}
try {
if (!isPrepared) {
player.prepare();
isPrepared = true;
}
player.start();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: lipangit/JiaoZiVideoPlayer
public long getDuration() {
long duration = 0;
//TODO MediaPlayer 判空的问题
// if (JZMediaManager.instance().mediaPlayer == null) return duration;
try {
duration = JZMediaManager.getDuration();
} catch (IllegalStateException e) {
e.printStackTrace();
return duration;
}
return duration;
}
代码示例来源:origin: lipangit/JiaoZiVideoPlayer
@Override
public void seekTo(long time) {
try {
mediaPlayer.seekTo((int) time);
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
代码示例来源:origin: reactive-streams/reactive-streams-jvm
private void done() {
//On this line we could add a guard against `!done`, but since rule 3.7 says that `Subscription.cancel()` is idempotent, we don't need to.
done = true; // If we `whenNext` throws an exception, let's consider ourselves done (not accepting more elements)
try {
subscription.cancel(); // Cancel the subscription
} catch(final Throwable t) {
//Subscription.cancel is not allowed to throw an exception, according to rule 3.15
(new IllegalStateException(subscription + " violated the Reactive Streams rule 3.15 by throwing an exception from cancel.", t)).printStackTrace(System.err);
}
}
代码示例来源:origin: reactive-streams/reactive-streams-jvm
private final void done() {
//On this line we could add a guard against `!done`, but since rule 3.7 says that `Subscription.cancel()` is idempotent, we don't need to.
done = true; // If `whenNext` throws an exception, let's consider ourselves done (not accepting more elements)
if (subscription != null) { // If we are bailing out before we got a `Subscription` there's little need for cancelling it.
try {
subscription.cancel(); // Cancel the subscription
} catch(final Throwable t) {
//Subscription.cancel is not allowed to throw an exception, according to rule 3.15
(new IllegalStateException(subscription + " violated the Reactive Streams rule 3.15 by throwing an exception from cancel.", t)).printStackTrace(System.err);
}
}
}
代码示例来源:origin: reactive-streams/reactive-streams-jvm
private void handleOnError(final Throwable error) {
if (subscription == null) { // Technically this check is not needed, since we are expecting Publishers to conform to the spec
// Publisher is not allowed to signal onError before onSubscribe according to rule 1.09
(new IllegalStateException("Publisher violated the Reactive Streams rule 1.09 signalling onError prior to onSubscribe.")).printStackTrace(System.err);
} else {
done = true; // Obey rule 2.4
whenError(error);
}
}
代码示例来源:origin: naman14/Timber
public void setVolume(final float vol) {
try {
mCurrentMediaPlayer.setVolume(vol, vol);
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
代码示例来源:origin: reactive-streams/reactive-streams-jvm
private void handleOnComplete() {
if (subscription == null) { // Technically this check is not needed, since we are expecting Publishers to conform to the spec
// Publisher is not allowed to signal onComplete before onSubscribe according to rule 1.09
(new IllegalStateException("Publisher violated the Reactive Streams rule 1.09 signalling onComplete prior to onSubscribe.")).printStackTrace(System.err);
} else {
done = true; // Obey rule 2.4
whenComplete();
}
}
代码示例来源:origin: lipangit/JiaoZiVideoPlayer
public long getCurrentPositionWhenPlaying() {
long position = 0;
//TODO 这块的判断应该根据MediaPlayer来
if (currentState == CURRENT_STATE_PLAYING ||
currentState == CURRENT_STATE_PAUSE) {
try {
position = JZMediaManager.getCurrentPosition();
} catch (IllegalStateException e) {
e.printStackTrace();
return position;
}
}
return position;
}
代码示例来源:origin: JessYanCoding/MVPArms
@Override
public void onDestroyView() {
if (mUnbinder != null && mUnbinder != Unbinder.EMPTY) {
try {
mUnbinder.unbind();
} catch (IllegalStateException e) {
e.printStackTrace();
//fix Bindings already cleared
Timber.w("onDestroyView: " + e.getMessage());
}
}
}
代码示例来源:origin: reactive-streams/reactive-streams-jvm
@Override public void onComplete() {
if (subscription == null) { // Technically this check is not needed, since we are expecting Publishers to conform to the spec
(new IllegalStateException("Publisher violated the Reactive Streams rule 1.09 signalling onComplete prior to onSubscribe.")).printStackTrace(System.err);
} else {
// Here we are not allowed to call any methods on the `Subscription` or the `Publisher`, as per rule 2.3
// And anyway, the `Subscription` is considered to be cancelled if this method gets called, as per rule 2.4
}
}
}
代码示例来源:origin: reactive-streams/reactive-streams-jvm
@Override public void onError(final Throwable t) {
if (subscription == null) { // Technically this check is not needed, since we are expecting Publishers to conform to the spec
(new IllegalStateException("Publisher violated the Reactive Streams rule 1.09 signalling onError prior to onSubscribe.")).printStackTrace(System.err);
} else {
// As per rule 2.13, we need to throw a `java.lang.NullPointerException` if the `Throwable` is `null`
if (t == null) throw null;
// Here we are not allowed to call any methods on the `Subscription` or the `Publisher`, as per rule 2.3
// And anyway, the `Subscription` is considered to be cancelled if this method gets called, as per rule 2.4
}
}
代码示例来源:origin: naman14/Timber
public void setDataSource(final String path) {
try {
mIsInitialized = setDataSourceImpl(mCurrentMediaPlayer, path);
if (mIsInitialized) {
setNextDataSource(null);
}
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
代码示例来源:origin: reactive-streams/reactive-streams-jvm
private void done() {
//On this line we could add a guard against `!done`, but since rule 3.7 says that `Subscription.cancel()` is idempotent, we don't need to.
done = true; // If we `whenNext` throws an exception, let's consider ourselves done (not accepting more elements)
try {
subscription.cancel(); // Cancel the subscription
} catch(final Throwable t) {
//Subscription.cancel is not allowed to throw an exception, according to rule 3.15
(new IllegalStateException(subscription + " violated the Reactive Streams rule 3.15 by throwing an exception from cancel.", t)).printStackTrace(System.err);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public Object invoke(MethodInvocation mi) throws Throwable {
String task = "get invocation on way IN";
try {
MethodInvocation current = ExposeInvocationInterceptor.currentInvocation();
assertEquals(mi.getMethod(), current.getMethod());
Object retval = mi.proceed();
task = "get invocation on way OUT";
assertEquals(current, ExposeInvocationInterceptor.currentInvocation());
return retval;
}
catch (IllegalStateException ex) {
System.err.println(task + " for " + mi.getMethod());
ex.printStackTrace();
throw ex;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!