运行 Blackberry 应用程序时应用程序错误:104非法参数异常

发布于 2024-12-07 00:42:22 字数 1106 浏览 3 评论 0原文

我创建了一个解析数据的应用程序,它将显示在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微暖i 2024-12-14 00:42:22

您忘记在将输入流传递给 parse() 方法之前通过 httpconnection 打开输入流。

在您的代码中,此行的 is == null

添加此行。

is = Conn.getInputStream();

在将 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

is = Conn.getInputStream();

before passing is to parse() method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文