Link to home
Start Free TrialLog in
Avatar of DanJW
DanJW

asked on

Properties 'load' function

Basically, this code snippet gets to the bit where is says "It gets here 2", what am I doing wrong?

{
  private Properties userInfo;
  private BufferedWriter out;
  private BufferedReader in;
  private MsgSvrConnection conn;

  public void execute() throws IOException
  {
    String sender = conn.getCurrentUser();
    String recipient = in.readLine();
    String content = in.readLine();
    FileInputStream fin = null;
    System.out.println("It gets here 1");
    try{
    fin = new FileInputStream(MsgProtocol.PASSWORD_FILE);
    System.out.println("It gets here 2");
    userInfo.load(fin);
    System.out.println("It gets here 3");
    System.out.println(userInfo.getProperty(recipient)+" recipient");
    }catch(IOException e)
    .............blah blah
ASKER CERTIFIED SOLUTION
Avatar of fivesigmaevent
fivesigmaevent

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fivesigmaevent
fivesigmaevent

Please check that it is being allocated elsewhere (which it possibly is) before execute() is called. If so, please disregard my previous comment. :-)
>>>
try{
   fin = new FileInputStream(MsgProtocol.PASSWORD_FILE);
   System.out.println("It gets here 2");
   userInfo.load(fin);
   System.out.println("It gets here 3");
   System.out.println(userInfo.getProperty(recipient)+" recipient");
   }catch(IOException e)
   .............blah blah
>>

change the exception handler to:
}catch(Exception e)
e.printStackTrace();
}
and post the exception stack trace
Avatar of DanJW

ASKER

Ha ha, just shows you how sometimes the simplest things are often overlooked.  I feel ashamed.