This is the mail archive of the mauve-discuss@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question about RandomAccessFile Code


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]