getting Null Pointer Exception......

Hi...i am uploading a file as FormFile (using Struts...)object and converting it to BufferedReader by using getInputStream() on file and casting InputStreamReader to BufferedReader. I now pass this BufferedReader object (say o1)to a function which reades the file header. Then i pass this object o1, to another function to read whole file.

In this process, i get Null pointer exception....... not able to find out WHY ? when the same object o1 worked for 1st function.Is this to do something with Struts?

Please advise.

[540 byte] By [Mayank_03a] at [2007-11-27 11:17:19]
# 1

Impossible to tell without code, please post the relevant one.

And please, do use code tags, see:

http://forum.java.sun.com/help.jspa?sec=formatting

dwga at 2007-7-29 14:24:14 > top of Java-index,Java Essentials,Java Programming...
# 2

This is what I am trying to dopublic void Start(BufferedReader fileReader)throws Exception{

tempCol=rc.HeaderCols(templateReader);

HeaderCols() makes a new BufferedReader object and logic works fine..

BufferedReader in=new BufferedReader(reader);

String [][] csvHeader = new String [5][200];

String strHeader = in.readLine();

I Again pass the BufferedReader fileReader argument of Start() to another method where I makes a new BufferedReader object and it gives Null PointerException.

public HashMap readFile(BufferedReader reader1) throws IOException{

BufferedReader inData=new BufferedReader(reader1);

String str;

Tokenize mt=new Tokenize();

while ((str = inData.readLine()) != null) {

.. logic goes here

Mayank_03a at 2007-7-29 14:24:14 > top of Java-index,Java Essentials,Java Programming...
# 3

What on earth makes you think we can work out what your problem is from that? You're the lucky one, you've got a stack trace in front of you. Interpet that, or if you can't, post it here. But don't just say "it doesn't work" and expect help. We're not mind readers!

georgemca at 2007-7-29 14:24:14 > top of Java-index,Java Essentials,Java Programming...