Problem on File read i build

[nobr]here the code

/*

* main.java

*

* Created on May 25, 2007, 10:50 PM

*

* To change this template, choose Tools | Template Manager

* and open the template in the editor.

*/

package Core;

import java.lang.*;

import java.io.*;

/**

*

* @author fastwings

*/

publicclass main{

String FileName ="test.txt";

File Fhandler;

String OnErr =null;

// Adler32 SumChk = new Adler32(); #not needed

/** Creates a new instance of main */

public main(){

}

public String ShowLoop(){

String htmlSets ="";

for (int i = 0 ; i<=50 ; i++){

String NoDot = Double.toString(i);

int dot = NoDot.indexOf(".");

htmlSets += NoDot.substring(0,dot) +" - ";

}

return htmlSets;

}

privatevoid ConFile (){

Fhandler =new File(FileName);

}

public String ReadFile(){

ConFile();

String Content ="";

try{

FileReader in =new FileReader(Fhandler);

try{

int chr;

while ((chr = in.read())!=-1){

Reader Words = in;

Content += Words;

while (true);

}

}

catch (EOFException e){}

in.close();

}

catch (IOException e){

OnErr ="Can't Open File <br /> "+e;

}

return Content;

}

}

my probelm that i dont get and input from the file witch its have content and ok and dont get any Exception

i just dont know what worng here[/nobr]

[3291 byte] By [Swolberga] at [2007-11-27 5:35:09]
# 1

There are several errors in this code.

1)

while ((chr = in.read())!=-1){

Reader Words = in;

Content += Words;

while (true);

}

This section is just littered with problems. I am not sure how it would even compile.

2) You are essentially swallowing an IOException here

catch (EOFException e) {}

in.close();

It's great that you are closing the stream but a stacktrace would probably be a good thing to add.

cotton.ma at 2007-7-12 15:03:57 > top of Java-index,Java Essentials,Java Programming...
# 2
first for the while (true);its was for debug stuff that forgot remover also its on web(jsp) so its oddly workssecand abouts that stacktrace how i can add at?
Swolberga at 2007-7-12 15:03:57 > top of Java-index,Java Essentials,Java Programming...