• Post Reply Bookmark Topic Watch Topic
  • New Topic

filenull problem  RSS feed

 
terry oliver
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

can ayone tell me why the text stream error is null the path is right

olly
[ June 08, 2008: Message edited by: Rob Prime ]
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags in the future. I've done it for you this time because I needed the proper indentation to see where the problem could be.

What do you mean with "text stream error"? Do you get an exception? Or does the code just exit? And if there is an exception, at which line? You can get that information from the stack trace; instead of the "System.err.println(ee);" line try calling "ee.printStackTrace();". That will tell you exactly on which line the exception has occurred.


I have checked the possibility of the mix of \ and / in the path (user.home would be something like C:\Documents and Settings\terry) would lead to any problems, but I doubt that is the case. The FileInputStream constructor that takes a String creates a File object with that String, then calls the constructor that takes a File. Now I've created a File object similar to your path, and it handled the \ and / occurrences quite well indeed.
[ June 08, 2008: Message edited by: Rob Prime ]
 
Prakash Subramanian
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should never get null. An exception is what should occur if something is wrong in this case. Are you sure that the System.exit() is occurring at that point?
 
terry oliver
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your help so far it seems that the file i am reading in which is a text file with content. the path is being recognized properly but for some reason flowing thou the file==null branch and it should not.

olly
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!