android is not throwing exception when it should...

Put your problem here if it does not fit any of the other categories.

android is not throwing exception when it should...

Postby arin » Sun Dec 27, 2009 7:21 pm

I am using this following function f1() in am android project... the
last line of the function SHOULD throw an exception as the twitter
username password is not correct, but it is not.. am I missing
anything here?

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private void f1() {
  2.  
  3.                 try {
  4.  
  5.                         // Create file
  6.  
  7.  
  8.  
  9.                         File f =new File(Environment.getExternalStorageDirectory(),
  10.  
  11.                         "gallery_pic.jpeg");
  12.  
  13.                         InputStream inputStream = new BufferedInputStream(new URL(
  14.  
  15.                                         "http://www.faronet.be/files/u16/wikipedia.jpg")
  16.  
  17.                                         .openStream(), 1024 * 4);
  18.  
  19.                         OutputStream out = new FileOutputStream(f);
  20.  
  21.                         byte buf[] = new byte[1024];
  22.  
  23.                         int len;
  24.  
  25.                         while ((len = inputStream.read(buf)) > 0)
  26.  
  27.                                 out.write(buf, 0, len);
  28.  
  29.                         out.close();
  30.  
  31.                         inputStream.close();
  32.  
  33.                         System.out.println("\nFile is created");
  34.  
  35.  
  36.  
  37.                         String username="appketttletest";
  38.  
  39.                         String pass="app";
  40.  
  41.                         TwitPic tpRequest = new TwitPic(username,pass);
  42.  
  43.                         TwitPicResponse tpResponse = null;
  44.  
  45.  
  46.  
  47.                         tpResponse = tpRequest.uploadAndPost(f, "Testing twitpic...");
  48.  
  49.                         System.out.println("user authenticated!!! he he, i dont know how");
  50.  
  51.  
  52.  
  53.                 } catch (Exception e) {
  54.  
  55.                         Log.i("error","faliled");
  56.  
  57.                         e.printStackTrace();
  58.  
  59.                 }
  60.  
  61. }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4
arin
Junior Developer
Junior Developer
 
Posts: 13
Joined: Thu Jul 09, 2009 10:17 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests