运行 Blackberry 应用程序时应用程序错误:104非法参数异常
我创建了一个解析数据的应用程序,它将显示在 ListRow 中,为此我创建了 http 连接,如下所示。
enter code here
public void run() {
System.out.println("Run Method called");
HttpConnection Conn = null;
InputStream is = null;
try {
System.out.println("Before Connection");
Conn = (HttpConnection) Connector.open("MYURL;deviceside=true" );
System.out.println("HTTP connection called");
//conn = (StreamConnection) Connector.open("http://xyz.com/Verandah/RSS/RSSContent.aspx?CatId=4;deviceside=true");
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setCoalescing(true);
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(is);
当我运行我的应用程序时,我收到 IllegalArgumentException。我已经编译了我的应用程序,我发现我在这一行中收到上述异常 Document doc = docBuilder.parse(is); 我做错了什么吗创建连接时出错?需要你的建议为什么我在这条线上遇到异常。 谢谢。
i have created one application which parsed the data and it will displyed in ListRow,for that i have created http connection as below.
enter code here
public void run() {
System.out.println("Run Method called");
HttpConnection Conn = null;
InputStream is = null;
try {
System.out.println("Before Connection");
Conn = (HttpConnection) Connector.open("MYURL;deviceside=true" );
System.out.println("HTTP connection called");
//conn = (StreamConnection) Connector.open("http://xyz.com/Verandah/RSS/RSSContent.aspx?CatId=4;deviceside=true");
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setCoalescing(true);
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(is);
when i am running my application i am getting IllegalArgumentException.i have compiled my application and i found i am getting the above exception in this line Document doc = docBuilder.parse(is); am i doing wrong anything wrong while creating a connection? need your suggestion why i am getting exception at this line.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您忘记在将输入流传递给 parse() 方法之前通过 httpconnection 打开输入流。
在您的代码中,此行的
is == null
。添加此行。
在将
is
传递给 parse() 方法之前You forgot to open inputstream over httpconnection before passing it to parse() method.
In your code
is == null
at this line.Add this line
before passing
is
to parse() method.