问题标签 [illegalstateexception]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
12886 浏览

java - 创建新的 Bufferstrategy 时出现非法状态异常

当我试图弄清楚如何使用缓冲策略时,总体上只是改进我编写代码和清理东西的方式。当我运行以下代码时,当我“createBufferStrategy(3)”时出现错误

然后添加基础:

我收到以下错误:

有人可以告诉我为什么会这样吗?也许可以解决这个问题?

谢谢

0 投票
2 回答
1022 浏览

android - Android MediaRecorder IllegalStateException

I am making an application that allows a user to record audio and save it somewhere in the SD card. I am using a MediaRecorder to do record the audio.

I am reusing some of the code from the androiddevblog website as it was recommended by another user on stackoverflow to check those tutorials.

My problem is whenever I click the button to record audio I get an error saying "Your Application has been forced to stop". I used the debugger to find out that it is because I have an illegalStateException on recorder.stop()

I am aware that nothing will get recorded based on my code. I want to first make sure the file gets created and saved.

I posted this question before, and solved my original problem but ran into this one after. So it may seem as a duplicate.

0 投票
4 回答
2348 浏览

java - PowerMock - 模拟静态系统类抛出 IllegalStateException

我有以下代码

正如我所说,在测试类中,必须模拟被测类(我无法创建新对象)。当我运行测试时,我得到:

我在这里阅读了文档http://code.google.com/p/powermock/wiki/MockSystem但测试仍然无法正常工作。我错过了什么吗?

编辑:我用一个真实的 A 对象测试了之前的代码(并将其从重放中删除)

但我仍然得到同样的例外。

0 投票
2 回答
4601 浏览

java - IllegalStateException:HttpServlet.service 中的 null

当请求失败时,我只是试图将错误发送回客户端。这是我的代码的样子:

此代码引发以下错误:

为什么会被扔在这里?在这个调用之前我没有做任何与响应对象有任何关系的事情,我什至没有接触它,直到这个错误在 if 子句中发送。为什么我会收到此错误?

0 投票
1 回答
531 浏览

playframework - 如何在playframework中绑定表单

非法状态异常

我正在尝试通过帖子提交表单值。但我得到了这个例外,我的用户正在扩展模型。看来,我没有从请求中得到任何值。有人可以告诉我我的错误在哪里吗?谢谢

0 投票
1 回答
459 浏览

android - 按钮上的 IllegalStateException

我遇到了这个异常,但描述对我一点帮助都没有:

抛出它的函数的代码(因为它发生在我单击特定按钮时)是:

问题是当这条线被删除时它不会这样做,所以我假设这是问题所在:(cuvAfisat = cuvAfisat.substring(0, poz*2-1)+ ghici+ cuvAfisat.substring(poz*2+1, cuvAfisat.length());它用来自 cuvAles 的一个字符替换来自 cuvAfisat 的字符,但它在每个字符之间都有空格,所以这就是为什么它有poz * 2。

提前感谢您的帮助!

编辑:

0 投票
2 回答
10897 浏览

android - AudioTrack:在未初始化的 AudioTrack 上调用 play()

我正在尝试使用 AudioTrack 类。基本上,当用户触摸屏幕上的特定对象时,我的应用程序必须产生声音。我已将此示例用作指南。
我的应用程序似乎可以正常工作,但通常在触摸屏幕大约一分钟后它会崩溃:

生成声音的类中的方法

这是我的线程使用的自定义视图中的一种方法

任何想法为什么会发生这种情况?

0 投票
1 回答
2675 浏览

netty - Netty - 查找频道 ID

我刚开始使用 Netty。我已经有一个服务器,我正在为一个客户端编写代码。

在客户端中,我使用此代码为 ClientBootstrap 对象设置了一个新的 PipelineFactory

其中 ResponseHandler() 是我扩展 SimpleChannelHandler 的类。

我正在寻找频道 ID。我做了

但它抛出 IllelgalStateException 并说我不能调用 getPipeline() 因为我调用了 setPipelineFactory()。获取 Channel ID 的方法是什么?

0 投票
3 回答
11867 浏览

android - 尝试重新打开一个已经关闭的对象:java.lang.IllegalStateException:?

我知道这个问题在 SO 中已经问了很多次,但我无法弄清楚我的确切问题。

我正在使用以下代码从数据库(表 1)中获取数据并根据检索值更新另一个表 2。它在某些 android 版本中运行良好,但是当我使用 Android 4.0.3 进行测试时。我得到这个java.lang.IllegalStateException:?.attempt to re-open an already-closed objectsum_cursor.moveToNext();

我在 AsyncTask 中使用此代码。

我的更新方法编码

我在这里做错了什么?

我知道你们很多人都遇到过这种情况。你们能帮帮我吗?

谢谢你的帮助。

0 投票
2 回答
4489 浏览

redirect - @PostConstruct 方法中的重定向导致 IllegalStateException

根据BalusC 的回答,我用

在我的@PostConstruct方法中阻止 JSF 呈现视图并重定向用户。但是,当我尝试运行代码时,我仍然遇到java.lang.IllegalStateException了上面一行的异常。

更新:我在我的@PostConstruct方法中添加了以下行:

我看到的是INIT true@PostConstruct我想知道在调用方法之前是否应该提交响应?

如果您能给我一个建议,我将不胜感激。