summaryrefslogtreecommitdiff
path: root/java/test/IceUtil/fileLock/ClientFail.java
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2014-10-23 16:28:09 -0230
committerMatthew Newhook <matthew@zeroc.com>2014-10-23 16:28:09 -0230
commitf6bb0396e7d8fd12ed50f72ab9fc99436d418576 (patch)
treeee6ef1cb32f2523839f210eb9ec3b924b97d5998 /java/test/IceUtil/fileLock/ClientFail.java
parentAdd Object.equals, and minor fix to HashMap.equals (diff)
downloadice-f6bb0396e7d8fd12ed50f72ab9fc99436d418576.tar.bz2
ice-f6bb0396e7d8fd12ed50f72ab9fc99436d418576.tar.xz
ice-f6bb0396e7d8fd12ed50f72ab9fc99436d418576.zip
More gradle changes.
Moved android stuff to its own package. Moved java tests to src/main/java/test subdirectory.
Diffstat (limited to 'java/test/IceUtil/fileLock/ClientFail.java')
-rw-r--r--java/test/IceUtil/fileLock/ClientFail.java85
1 files changed, 0 insertions, 85 deletions
diff --git a/java/test/IceUtil/fileLock/ClientFail.java b/java/test/IceUtil/fileLock/ClientFail.java
deleted file mode 100644
index c96dc7c9b57..00000000000
--- a/java/test/IceUtil/fileLock/ClientFail.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package test.IceUtil.fileLock;
-
-import java.io.File;
-import java.io.RandomAccessFile;
-import java.io.EOFException;
-import java.io.UTFDataFormatException;
-import java.io.IOException;
-
-
-public class ClientFail
-{
- private static void
- test(boolean b)
- {
- if(!b)
- {
- throw new RuntimeException();
- }
- }
-
- public static void
- main(String[] argvs)
- {
-
- try
- {
- new IceUtilInternal.FileLock("file.lock");
- test(false);
- }
- catch(IceUtil.FileLockException ex)
- {
- System.out.println("File lock not acquired.");
- //
- // Try to read the pid of the lock owner from the lock file, in Windows
- // we don't write pid to lock files.
- //
- if(!System.getProperty("os.name").startsWith("Windows"))
- {
- String pid = "";
- try
- {
- RandomAccessFile file = new RandomAccessFile(new File("file.lock"), "r");
- try
- {
- pid = file.readUTF();
- }
- finally
- {
- file.close();
- }
- }
- catch(EOFException eofEx)
- {
- System.out.println("exception:\n" + eofEx.toString());
- test(false);
- }
- catch(UTFDataFormatException utfEx)
- {
- System.out.println("exception:\n" + utfEx.toString());
- test(false);
- }
- catch(IOException ioEx)
- {
- System.out.println("exception:\n" + ioEx.toString());
- test(false);
- }
-
- if(pid.length() == 0)
- {
- test(false);
- }
- System.out.println("Lock owned by: " + pid);
- }
- }
- }
-}