public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* Question about RandomAccessFile Code
@ 2002-11-14  8:04 Patrick Ellis
  2002-11-14 13:25 ` Daryl Lee
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Ellis @ 2002-11-14  8:04 UTC (permalink / raw)
  To: mauve-discuss; +Cc: Mark Wielaard (E-mail), Tom Tromey (E-mail)

Mark/Tom,

During testing of the RandomAccessFile code, a file is create during execution called "raftmpfile". This
file is used during testing. 
My question is the code makes reference to the file twice in io/RandomAccessFile/jdk11.java but
raf2 is not used anywhere else in the code. A problem occurs on the VMS platform because of the
creation of the file twice in the below code. Was this the intent of the code or a bug ?  
        
        String fname = "raftmpfile";
        RandomAccessFile raf, raf2;
        int rdcnt;
        byte[] buf = { 0, 0, 0, 0 };

        // Start by deleting test file, if it exists,
        //      to clear out any leftover data

        File f = new File(fname);
        if (f.exists()) {
                f.delete();
        }

        // new RandomAccessFile(fname, mode)
    try {
        raf2 = new RandomAccessFile(f, "rw");
        }
        catch (IOException e) {
                harness.fail("new RandomAccessFile(File, mode): Can't open file " + fname);
                return;  // can't proceed without open file
        }

        // new RandomAccessFile(filename, mode);
        try {
        raf = new RandomAccessFile(fname, "rw");
        }
        catch (IOException e) {
                harness.fail("new RandomAccessFile(Filename, mode): Can't open file " + fname);
                return;  // can't proceed without open file
        }
        try {
                FileDescriptor fd = raf.getFD();
        }
        catch (IOException e) {
                harness.fail("getFD(): Can't get FileDescriptor");
                return;  // shouldn't proceed if no FileDescriptor
        }

Pat Ellis
SDE Build and Test Team
Phone:      (919) 531-0355   
R2263     Patrick.Ellis@sas.com
SAS...  The Power to Know


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question about RandomAccessFile Code
  2002-11-14  8:04 Question about RandomAccessFile Code Patrick Ellis
@ 2002-11-14 13:25 ` Daryl Lee
  0 siblings, 0 replies; 2+ messages in thread
From: Daryl Lee @ 2002-11-14 13:25 UTC (permalink / raw)
  To: Patrick Ellis, Mauve Discuss
  Cc: mauve-discuss, Mark Wielaard (E-mail), Tom Tromey (E-mail)

I think the raf2 reference must be a residual of some code that I didn't
clean up well when I was in there last.  I've tested the code without it
and it seems okay.  I'll get it checked in shortly.

On Thu, Nov 14, 2002 at 11:04:12AM -0500, Patrick Ellis wrote:
> Mark/Tom,
> 
> During testing of the RandomAccessFile code, a file is create during execution called "raftmpfile". This
> file is used during testing. 
> My question is the code makes reference to the file twice in io/RandomAccessFile/jdk11.java but
> raf2 is not used anywhere else in the code. A problem occurs on the VMS platform because of the
> creation of the file twice in the below code. Was this the intent of the code or a bug ?  
>         
>         String fname = "raftmpfile";
>         RandomAccessFile raf, raf2;
>         int rdcnt;
>         byte[] buf = { 0, 0, 0, 0 };
> 
>         // Start by deleting test file, if it exists,
>         //      to clear out any leftover data
> 
>         File f = new File(fname);
>         if (f.exists()) {
>                 f.delete();
>         }
> 
>         // new RandomAccessFile(fname, mode)
>     try {
>         raf2 = new RandomAccessFile(f, "rw");
>         }
>         catch (IOException e) {
>                 harness.fail("new RandomAccessFile(File, mode): Can't open file " + fname);
>                 return;  // can't proceed without open file
>         }
> 
>         // new RandomAccessFile(filename, mode);
>         try {
>         raf = new RandomAccessFile(fname, "rw");
>         }
>         catch (IOException e) {
>                 harness.fail("new RandomAccessFile(Filename, mode): Can't open file " + fname);
>                 return;  // can't proceed without open file
>         }
>         try {
>                 FileDescriptor fd = raf.getFD();
>         }
>         catch (IOException e) {
>                 harness.fail("getFD(): Can't get FileDescriptor");
>                 return;  // shouldn't proceed if no FileDescriptor
>         }
> 
> Pat Ellis
> SDE Build and Test Team
> Phone:      (919) 531-0355   
> R2263     Patrick.Ellis@sas.com
> SAS...  The Power to Know
> 
> 
> 
> 

-- 
Daryl Lee
Marietta, GA

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-14 21:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-14  8:04 Question about RandomAccessFile Code Patrick Ellis
2002-11-14 13:25 ` Daryl Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).