Code example for OptionalDataException

Methods: printStackTrace

0
 
        } catch (FileNotFoundException e)
        { 
        } catch (OptionalDataException e)
        { 
            e.printStackTrace();
        } catch (ClassNotFoundException e)
        { 
            e.printStackTrace();
        } catch (IOException e)
        { 
            e.printStackTrace();
        } 
        Controller.loadPassword(ctx);
    } 
 
    /** 
     * loadPassword 
     *  
     * Load the password from the file and set the context 
     *  
     * @param c 
     *            The context the password was saved in 
     */ 
    public static void loadPassword(Context c)
    { 
 
        try 
        { 
            ctx = c;
            FileInputStream stream = c.openFileInput(passwordFileName);
            if (stream == null)
            { 
                return; 
            } 
 
            ObjectInputStream in = new ObjectInputStream(stream);
            Object temp = in.readObject();
            if (temp != null)
            { 
                String tt = (String) temp;
                stream.close();
                Controller.setPassword(tt);
            } 
 
        } catch (FileNotFoundException e)
        { 
        } catch (OptionalDataException e)
        { 
            e.printStackTrace();
        } catch (ClassNotFoundException e)
        { 
            e.printStackTrace();
        } catch (IOException e)
        {