0

I have code structurred in this way

public void generalMethod(){
   try{
     methodThatStartAsyncWebTask();
   catch(Exception e){
     offlineDataAlternativeMethod();
   }

}

the method

public void offlineDataAlternativeMethod(){
      try(
        loadArchivedFile();
      }
      catch(Exception e){
        reInitializeeData();
     }

}

The App crashes at line loadArchivedFile(); that fails because doesn't found the file, but the strange thing is that catch block that invokes reInitializeeData(); isn't reached.

Why cannot reach catch block in anyway? Any idea?

This is the first time that see a similar issue. Any solution?

AndreaF
  • 11,975
  • 27
  • 102
  • 168
  • could you show some code of loadArchivedFile? you are not showing your stackTrace. e.printStackTrace(); – Illegal Argument Sep 12 '14 at 03:01
  • the stacktrace is too long but simply that FileNotFound exception generated by `loadArchivedFile()` isn't captured as expected – AndreaF Sep 12 '14 at 03:25

1 Answers1

0

Try this

getting file not found exception

Community
  • 1
  • 1
easywaru
  • 1,073
  • 9
  • 17
  • 1
    try this. http://stackoverflow.com/questions/8845534/getting-file-not-found-exception – easywaru Sep 12 '14 at 04:36
  • ok this works, thanks... but why the hell try catch doesn't work? FileNotFoundException should inherit from Exception, so I cannot understand the reason of this issue – AndreaF Sep 12 '14 at 09:07
  • Maybe class you used is only for java not for amdroid, then android vertual marchine occurs runtime errors, then virtual machine is dead. This is only my thought, i dont know why occured not yet – easywaru Sep 12 '14 at 12:29