android - OpenFileInput does NOT throw FileNotFoundException -


i'm participating in online android course , have (so far) gotten no response on forum issue. i'm using android studio on windows 8.1.

i have following function read file , load adapter:

private void loaditems() {     bufferedreader reader = null;     try {         fileinputstream fis = openfileinput(file_name);         reader = new bufferedreader(new inputstreamreader(fis));          string title = null;         string priority = null;         string status = null;         date date = null;          while (null != (title = reader.readline())) {             priority = reader.readline();             status = reader.readline();             date = todoitem.format.parse(reader.readline());             madapter.add(new todoitem(title, priority.valueof(priority),                     status.valueof(status), date));         }      } catch (filenotfoundexception e) {         e.printstacktrace();     } catch (ioexception e) {         e.printstacktrace();     } catch (parseexception e) {         e.printstacktrace();     } {         if (null != reader) {             try {                 reader.close();             } catch (ioexception e) {                 e.printstacktrace();             }         }     } } 

my questions are:

  1. i don't find file named constant file_name anywhere on hard drive. if file doesn't exist shouldn't openfileinput() throw filenotfoundexception?

  2. why inputstreamreader not throw error?

  3. via debugger, i've watched logic guarding entry while construct happily allows null value in title variable enter loop. missing here?

thanks in advance light can shed!!

markb


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -