Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

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
0
DanJW
Asked:
DanJW
  • 2
1 Solution
 
fivesigmaeventCommented:
It looks like from your code, the userInfo is not allocated before you try to invoke its member method.

0
 
fivesigmaeventCommented:
Please check that it is being allocated elsewhere (which it possibly is) before execute() is called. If so, please disregard my previous comment. :-)
0
 
Venci75Commented:
>>>
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
0
 
DanJWAuthor Commented:
Ha ha, just shows you how sometimes the simplest things are often overlooked.  I feel ashamed.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now