harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Pavlenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4989) [classlib][nio] FileChannel.tryLock() does not work on Linux
Date Mon, 22 Oct 2007 09:46:50 GMT
[classlib][nio] FileChannel.tryLock() does not work on Linux
------------------------------------------------------------

                 Key: HARMONY-4989
                 URL: https://issues.apache.org/jira/browse/HARMONY-4989
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Andrey Pavlenko


The following test fails on SLES10

import java.io.File;
import java.io.FileOutputStream;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.OverlappingFileLockException;

import junit.framework.TestCase;

public class Test extends TestCase {

    public void testTryLock() throws Exception {
        final File f = File.createTempFile("try", "lock");
        final FileChannel fc1 = new RandomAccessFile(f, "rw").getChannel();
        final FileChannel fc2 = new RandomAccessFile(f, "rw").getChannel();
        final FileOutputStream fos = new FileOutputStream(f);
        
        f.deleteOnExit();
        fos.write("Hello".getBytes());
        fos.flush();
        fos.close();
        fc1.lock();

        try {
            assertNull(fc2.tryLock());
        } catch (OverlappingFileLockException ex) {
            // expected
        }
    }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message