/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 4429043 4493595 6332756 6709457
* @summary The FileChannel file locking
*/
/**
* Testing FileChannel's lock method.
*/
public class Lock {
} else {
}
return;
}
blah.deleteOnExit();
}
if (b)
else
}
// Grab the lock
throw new RuntimeException("Lock should not return null");
try {
throw new RuntimeException("Overlapping locks allowed");
} catch (OverlappingFileLockException e) {
// Correct result
}
}
// Exec the tamperer
if (testClasses != null)
(new InputStreamReader(p.getInputStream()));
String s;
int count = 0;
if (!s.equals("good")) {
// Fails on windows over NFS...
throw new RuntimeException("Failed: "+s);
}
}
count++;
}
if (count == 0) {
}
throw new RuntimeException("Failed, no output");
}
// Clean up
/* Check multiple releases */
}
}
// The overlap check for file locks should be JVM-wide
// lock via one channel, and then attempt to lock the same file
// using a second channel
try {
throw new RuntimeException("Overlapping locks allowed");
} catch (OverlappingFileLockException x) {
}
try {
throw new RuntimeException("Overlapping locks allowed");
} catch (OverlappingFileLockException x) {
}
// release lock and the attempt to lock with the second channel
// should succeed.
try {
throw new RuntimeException("Overlapping locks allowed");
} catch (OverlappingFileLockException x) {
}
}
/**
* Test file locking when file is opened for append
*/
}
}
}
}
class MadWriter {
}
if (b)
else
} else {
if (b)
else
}
}
}