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 except开发者_开发百科ion at this line. thanks.
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.
精彩评论