method does not write

L

Loek Raemakers

Ls,
My application runs on a Novell intra-network (NDS6).
The application consists of different frames.
My problem is: one method does not write to a file.
On a stand alone (Windows '98 and XP) this problem does not occur.
The method is:
public void Herschrijver()
{
String text = "blablabla";
String dir = System.getProperty("user.dir");
String sep = System.getProperty("file.separator");
String bestand = "Opgaven.txt";
String pad = dir + sep + bestand;
try
{
Writer fw = new FileWriter(pad);
w.write(text);
fw.close();
}
catch(Exception e)
{
//ta.setText("Fout bij opslaan" + "\n" + e.toString());
}
//ta.setText("Goed opgeslagen");
}
Using the next line of code in the above method works fine;
Writer fw = new FileWriter(pad,true);// append text, is not what I want.
Using 'false' instead of 'true' does not write.
On the file 'Opgaven.txt' I have the netware rights indicated by:
R-W-E-C-M-F.
I do not catch an exception, I get the message in textarea (ta): Goed opgeslagen
Does my (bad) java code cause the problem?
Is it a question of netware rights or inheritance of these rights by different
frames?
Thanks for any help.
Loek eR
 
A

Andrew Thompson

On Nov 8, 4:23 am, (e-mail address removed) (Loek Raemakers) wrote:
....
My problem is: one method does not write to a file. ....
I do not catch an exception, I get the message in textarea (ta): Goed opgeslagen
Does my (bad) java code cause the problem?

You might try a flush() before the stream close().

If that does not work, I suggest you prepare an SSCCE.

Andrew T.
 
E

Esmond Pitt

Andrew said:
You might try a flush() before the stream close().

The close() method is inherited and specified there to call flush() so
that won't help.

@OP: the code you posted suppresses exception traces. I suspect an
exception is being thrown and ignored.
 
A

Andrew Thompson

Esmond Pitt wrote:
...
@OP: the code you posted suppresses exception traces. ..

NO IT DOES NOT.. oh wait - yes it does. I thought I'd
ruled that out. (grumbles) Damn snippets.
..I suspect an
exception is being thrown and ignored.

Tut, tut. Never swallow stacktraces. They are your
friend* when you have no others.

* But they are not good drinking buddies, and don't ever
loan them your car..

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
 
L

Loek Raemakers

Thanks for the reactions,

I will stop suppressing exceptions.
Next week I have the opportunity to see the result.

Loek eR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

applications does not write 3
JSP problems 2

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top