Board index » java-programmer » Re : Fun Java <-> Windows file timestamp bug

Re : Fun Java <-> Windows file timestamp bug

2003-11-14 09:06:00 AM
The Ghost In The Machine wrote:
Quote
I'm hoping this one's been reported already, but it's a weird one.

---- file fts.java ----

import java.io.*;

public class fts
{
public static void main(String[] args) throws Exception
{
FileOutputStream fos = new
FileOutputStream("d_fts.dat"); BufferedOutputStream
bos = new BufferedOutputStream(fos); while(true)
{
bos.write(new
java.util.Date().toString().getBytes());

for(int i = 0; i < 60; i++)
bos.write('*');
bos.write('\n');

Thread.sleep(5000L);
}
}
}

----

As you can probably see, this simply creates a file
d_fts.dat and then writes to it on a periodic basis.
Works fine on a new create on both Linux and Windows,
but if d_fts.dat exists already on Windows, the timestamp
on that file will not be updated after initial open until
the program is forced to exit with a control-C. However,
the size of the file and its contents do update.
Windows does not update a file's modified timestamp until you close
the open file handle.
Windows makes you stupid.
Kadaitcha Man: Kicking fuckwits in the head on Usenet since 1989
kadaitcha.kicks-ass.org/
Linux makes you stupid
-
 

Re:Re : Fun Java <-> Windows file timestamp bug

Kadaitcha Man[Thu, 13 Nov 2003 17:05:51
-0800].<e42881a8.0311131705.780f11d7@posting.google.com>+=
Quote
The Ghost In The Machine wrote:
Quote
I'm hoping this one's been reported already, but it's a weird one.

---- file fts.java ----

import java.io.*;

public class fts
{
public static void main(String[] args) throws Exception
{
FileOutputStream fos = new
FileOutputStream("d_fts.dat"); BufferedOutputStream
bos = new BufferedOutputStream(fos); while(true)
{
bos.write(new
java.util.Date().toString().getBytes());

for(int i = 0; i < 60; i++)
bos.write('*');
bos.write('\n');

Thread.sleep(5000L);
}
}
}

----

As you can probably see, this simply creates a file
d_fts.dat and then writes to it on a periodic basis.
Works fine on a new create on both Linux and Windows,
but if d_fts.dat exists already on Windows, the timestamp
on that file will not be updated after initial open until
the program is forced to exit with a control-C. However,
the size of the file and its contents do update.

Windows does not update a file's modified timestamp until you close
the open file handle.

Windows makes you stupid.


--
Kadaitcha Man: Kicking fuckwits in the head on Usenet since 1989
kadaitcha.kicks-ass.org/
Linux makes you stupid
That's nothing.
At work, we use a java server app
that will import a CSV file into
a sql svr db and
randomly shift the decimal point
on numeric fields (!)
How can this be? Does java have any
flaws with floating point? Isn't that
the type of thing that 'safe' languages
prevent? Or is it the Xeon processors?
How could that happen? To me, it seems
impossible -- but there it is -- random
shifts in the position of the decimal
on a text file import via a java service
(not java server, or java server pages, but
an EJB type application written as
a Windos server) to a database?
How?
-

Re:Re : Fun Java <-> Windows file timestamp bug

Bailo John <bailo@j.us>wrote or quoted:
Quote
At work, we use a java server app
that will import a CSV file into
a sql svr db and randomly shift the
decimal point on numeric fields (!)

How can this be?
It sounds like you are using buggy software.
Quote
Does java have any flaws with floating point?
Not like that.
Quote
Isn't that the type of thing that 'safe' languages prevent?
No.
--
__________
|im |yler timtyler.org/ tim@tt1lock.org Remove lock to reply.
-

Re:Re : Fun Java <-> Windows file timestamp bug

Tim Tyler wrote:
Quote
Bailo John <bailo@j.us>wrote or quoted:


Quote
At work, we use a java server app
that will import a CSV file into
a sql svr db and randomly shift the
decimal point on numeric fields (!)

How can this be?


It sounds like you are using buggy software.

It is buggy yes, but the kind of problem
described could not be a code bug -- it would
have to be in java, the VM, the OS or the
hardware itself.
Quote

Quote
Does java have any flaws with floating point?


Not like that.

well it do now
Quote

Quote
Isn't that the type of thing that 'safe' languages prevent?


No.
sure they do... this is one of htose issues
that could only happen with unmanaged pointer
arithmetic -- yet here it happening with 'managed'
java code.
what bullshit
-

Re:Re : Fun Java <-> Windows file timestamp bug

In comp.lang.java.advocacy Hello! My Name Is... <Hello@myname.is>wrote or quoted:
Quote
Tim Tyler wrote:
Quote
Bailo John <bailo@j.us>wrote or quoted:
>At work, we use a java server app
>that will import a CSV file into
>a sql svr db and randomly shift the
>decimal point on numeric fields (!)
>
>How can this be?

It sounds like you are using buggy software.

It is buggy yes, but the kind of problem
described could not be a code bug [...]
Why not?
Quote
>Isn't that the type of thing that 'safe' languages prevent?

No.

sure they do... this is one of htose issues
that could only happen with unmanaged pointer
arithmetic [...]
No it isn't.
--
__________
|im |yler timtyler.org/ tim@tt1lock.org Remove lock to reply.
-

Re:Re : Fun Java <-> Windows file timestamp bug

"Bailo John" <bailo@j.us>wrote in message news:<bfb254d7b2f3a407676c3fad211d8ec9@news.teranews.com>...
Quote
Kadaitcha Man[Thu, 13 Nov 2003 17:05:51
-0800].<e42881a8.0311131705.780f11d7@posting.google.com>+=

That's nothing.

At work, we use a java server app
that will import a CSV file into
a sql svr db and
randomly shift the decimal point
on numeric fields (!)

How can this be? Does java have any
flaws with floating point? Isn't that
the type of thing that 'safe' languages
prevent? Or is it the Xeon processors?

How could that happen? To me, it seems
impossible -- but there it is -- random
shifts in the position of the decimal
on a text file import via a java service
(not java server, or java server pages, but
an EJB type application written as
a Windos server) to a database?

How?
...a bug in the program you're using...? (not the JVM)
-