You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/04/29 09:05:37 UTC

svn commit: r1097705 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/ java/org/apache/commons/runtime/platform/unix/ java/org/apache/commons/runtime/platform/windows/ native/include/acr/ native/shared/

Author: mturk
Date: Fri Apr 29 07:05:36 2011
New Revision: 1097705

URL: http://svn.apache.org/viewvc?rev=1097705&view=rev
Log:
Second phase of using IOException

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Semaphore.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Shm.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/FcntlMutex.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutex.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphore.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShm.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVShm.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java
    commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h
    commons/sandbox/runtime/trunk/src/main/native/shared/error.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java Fri Apr 29 07:05:36 2011
@@ -15,7 +15,7 @@
  */
 package org.apache.commons.runtime;
 
-import org.apache.commons.runtime.io.RuntimeIOException;
+import java.io.IOException;
 
 /**
  * Mutex class.
@@ -111,7 +111,7 @@ public abstract class Mutex
      *
      */
     public abstract void acquire()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Acquires a permit from this semaphore, only if one is available
@@ -119,21 +119,21 @@ public abstract class Mutex
      *
      */
     public abstract boolean tryAcquire()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Releases a permit.
      *
      */
     public abstract void release()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Closes the semaphore.
      *
      */
     public abstract void close()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Get Mutex name.

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Semaphore.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Semaphore.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Semaphore.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Semaphore.java Fri Apr 29 07:05:36 2011
@@ -15,7 +15,7 @@
  */
 package org.apache.commons.runtime;
 
-import org.apache.commons.runtime.io.RuntimeIOException;
+import java.io.IOException;
 
 /**
  * Semaphore class.
@@ -85,7 +85,7 @@ public abstract class Semaphore
      *
      */
     public abstract void acquire()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Acquires a permit from this semaphore, only if one is available
@@ -93,28 +93,28 @@ public abstract class Semaphore
      *
      */
     public abstract boolean tryAcquire()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Releases a permit.
      *
      */
     public abstract void release()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Clears the Semaphore.
      *
      */
     public abstract void clear()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Closes the semaphore.
      *
      */
     public abstract void close()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Get Semaphore name.

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Shm.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Shm.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Shm.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Shm.java Fri Apr 29 07:05:36 2011
@@ -16,7 +16,6 @@
 package org.apache.commons.runtime;
 
 import org.apache.commons.runtime.io.Syncable;
-import org.apache.commons.runtime.io.RuntimeIOException;
 import java.io.IOException;
 import java.io.SyncFailedException;
 
@@ -74,7 +73,7 @@ public abstract class Shm implements Syn
      * suitable (unused) address at which to attach the segment.
      */
     public abstract Pointer attach(long address, boolean readOnly)
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Attaches the shared memory segment to the address
@@ -83,7 +82,7 @@ public abstract class Shm implements Syn
      * suitable (unused) address at which to attach the segment.
      */
     public Pointer attach(boolean readOnly)
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         return attach(0L, readOnly);
     }
@@ -95,7 +94,7 @@ public abstract class Shm implements Syn
      * by the attaching attach() call.
      */
     public abstract void detach()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Returns the shared memory size.
@@ -151,7 +150,7 @@ public abstract class Shm implements Syn
      *
      */
     public abstract void close()
-        throws RuntimeIOException, SystemException;
+        throws IOException;
 
     /**
      * Get Shm name.

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/FcntlMutex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/FcntlMutex.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/FcntlMutex.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/FcntlMutex.java Fri Apr 29 07:05:36 2011
@@ -22,8 +22,8 @@ import org.apache.commons.runtime.Alread
 import org.apache.commons.runtime.InvalidArgumentException;
 import org.apache.commons.runtime.NoSuchObjectException;
 import org.apache.commons.runtime.SystemException;
-import org.apache.commons.runtime.io.RuntimeIOException;
 import org.apache.commons.runtime.io.ClosedDescriptorException;
+import java.io.IOException;
 
 /**
  * FcntlMutex class.
@@ -72,18 +72,20 @@ final class FcntlMutex extends Mutex
         this.owner = owner;
     }
 
+    @Override
     public void acquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
         int rc = wait0(fd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public boolean tryAcquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -92,21 +94,23 @@ final class FcntlMutex extends Mutex
             return true;
         else if (rc == Errno.EBUSY)
             return false;
-        throw new SystemException(Status.describe(rc));
+        throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void release()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
         int rc = release0(fd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void close()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -116,7 +120,7 @@ final class FcntlMutex extends Mutex
         }
         int rc = Posix.close(fd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
         fd = -1;
     }
 

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutex.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutex.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutex.java Fri Apr 29 07:05:36 2011
@@ -22,6 +22,7 @@ import org.apache.commons.runtime.Invali
 import org.apache.commons.runtime.NoSuchObjectException;
 import org.apache.commons.runtime.OperationNotImplementedException;
 import org.apache.commons.runtime.SystemException;
+import java.io.IOException;
 
 /**
  * PosixMutex class.
@@ -55,26 +56,30 @@ final class PosixMutex extends Mutex
         this.owner = owner;
     }
 
+    @Override
     public void acquire()
-        throws SystemException
+        throws IOException
     {
         mutex.acquire();
     }
 
+    @Override
     public boolean tryAcquire()
-        throws SystemException
+        throws IOException
     {
         return mutex.tryAcquire();
     }
 
+    @Override
     public void release()
-        throws SystemException
+        throws IOException
     {
         mutex.release();
     }
 
+    @Override
     public void close()
-        throws SystemException
+        throws IOException
     {
         mutex.close();
     }

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphore.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphore.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphore.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphore.java Fri Apr 29 07:05:36 2011
@@ -23,8 +23,8 @@ import org.apache.commons.runtime.Invali
 import org.apache.commons.runtime.NameTooLongException;
 import org.apache.commons.runtime.NoSuchObjectException;
 import org.apache.commons.runtime.SystemException;
-import org.apache.commons.runtime.io.RuntimeIOException;
 import org.apache.commons.runtime.io.ClosedDescriptorException;
+import java.io.IOException;
 
 /**
  * PosixSemaphore class.
@@ -106,18 +106,20 @@ final class PosixSemaphore extends Semap
         owner = false;
     }
 
+    @Override
     public void acquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (sd == 0L)
             throw new ClosedDescriptorException();
         int rc = wait0(sd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public boolean tryAcquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (sd == 0L)
             throw new ClosedDescriptorException();
@@ -126,21 +128,23 @@ final class PosixSemaphore extends Semap
             return true;
         else if (rc == Errno.EBUSY)
             return false;
-        throw new SystemException(Status.describe(rc));        
+        throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void release()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (sd == 0L)
             throw new ClosedDescriptorException();
         int rc = release0(sd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void clear()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         boolean once = false;
         
@@ -158,14 +162,15 @@ final class PosixSemaphore extends Semap
                 }
                 else {
                     // Not an owner
-                    throw new SystemException(Status.describe(rc));
+                    throw new IOException(Status.describe(rc));
                 }
             }
         }        
     }
 
+    @Override
     public void close()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         int rc;
         if (sd == 0L)
@@ -174,11 +179,11 @@ final class PosixSemaphore extends Semap
             // Unlink if we are the semaphore owner.
             rc = unlink0(name);
             if (rc != 0)
-                throw new SystemException(Status.describe(rc));
+                throw new IOException(Status.describe(rc));
         }
         rc = close0(sd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
         sd = 0L;
     }
     

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShm.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShm.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShm.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShm.java Fri Apr 29 07:05:36 2011
@@ -24,7 +24,6 @@ import org.apache.commons.runtime.Invali
 import org.apache.commons.runtime.NoSuchObjectException;
 import org.apache.commons.runtime.SystemException;
 import org.apache.commons.runtime.io.Syncable;
-import org.apache.commons.runtime.io.RuntimeIOException;
 import org.apache.commons.runtime.io.ClosedDescriptorException;
 import java.io.IOException;
 import java.io.SyncFailedException;
@@ -103,7 +102,7 @@ final class PosixShm extends Shm
 
     @Override
     public final Pointer attach(long addr, boolean readOnly)
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -117,7 +116,7 @@ final class PosixShm extends Shm
                 prot |= Posix.PROT_WRITE;
             base = Posix.mmap(addr, size, prot, Posix.MAP_SHARED, fd, 0L);
             if (base == 0L)
-                throw new SystemException(Errno.msg());
+                throw new IOException(Errno.msg());
             if (readOnly)
                 bptr = Posix.pointer(base, size, Posix.CONST_POINTER);
             else
@@ -128,7 +127,7 @@ final class PosixShm extends Shm
 
     @Override
     public final void detach()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -136,7 +135,7 @@ final class PosixShm extends Shm
             if (base != 0L) {
                 int rc = Posix.munmap(base, size);
                 if (rc != 0)
-                    throw new SystemException(Status.describe(rc));
+                    throw new IOException(Status.describe(rc));
                 base = 0L;
                 bptr = null;
             }
@@ -167,18 +166,18 @@ final class PosixShm extends Shm
 
     @Override
     public final void close()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
         detach();
         int rc = Posix.close(fd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
         if (owner) {
             rc = unlink0(name);
             if (rc != 0)
-                throw new SystemException(Status.describe(rc));
+                throw new IOException(Status.describe(rc));
         }
         fd = -1;
     }

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVMutex.java Fri Apr 29 07:05:36 2011
@@ -22,8 +22,8 @@ import org.apache.commons.runtime.NoSuch
 import org.apache.commons.runtime.InvalidArgumentException;
 import org.apache.commons.runtime.OperationNotImplementedException;
 import org.apache.commons.runtime.SystemException;
-import org.apache.commons.runtime.io.RuntimeIOException;
 import org.apache.commons.runtime.io.ClosedDescriptorException;
+import java.io.IOException;
 
 /**
  * SysVMutex class.
@@ -73,18 +73,20 @@ final class SysVMutex extends Mutex
         this.owner = owner;
     }
 
+    @Override
     public void acquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
         int rc = wait0(fd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public boolean tryAcquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -93,21 +95,23 @@ final class SysVMutex extends Mutex
             return true;
         if (Status.IS_EBUSY(rc))
             return false;
-        throw new SystemException(Status.describe(rc));
+        throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void release()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
         int rc = release0(fd);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void close()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -116,7 +120,7 @@ final class SysVMutex extends Mutex
             Posix.unlink(name);
             int rc = close0(fd);
             if (rc != 0)
-                throw new SystemException(Status.describe(rc));
+                throw new IOException(Status.describe(rc));
         }
         fd = -1;
     }

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVShm.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVShm.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVShm.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SysVShm.java Fri Apr 29 07:05:36 2011
@@ -23,7 +23,6 @@ import org.apache.commons.runtime.Invali
 import org.apache.commons.runtime.NoSuchObjectException;
 import org.apache.commons.runtime.SystemException;
 import org.apache.commons.runtime.io.Syncable;
-import org.apache.commons.runtime.io.RuntimeIOException;
 import org.apache.commons.runtime.io.ClosedDescriptorException;
 import java.io.IOException;
 import java.io.SyncFailedException;
@@ -91,7 +90,7 @@ final class SysVShm extends Shm
 
     @Override
     public final Pointer attach(long addr, boolean readOnly)
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -111,7 +110,7 @@ final class SysVShm extends Shm
 
     @Override
     public final void detach()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -119,7 +118,7 @@ final class SysVShm extends Shm
             if (base != 0L) {
                 int rc = shmdt0(base);
                 if (rc != 0)
-                    throw new SystemException(Status.describe(rc));
+                    throw new IOException(Status.describe(rc));
                 base = 0L;
                 bptr = null;
             }
@@ -150,7 +149,7 @@ final class SysVShm extends Shm
 
     @Override
     public final void close()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (fd == -1)
             throw new ClosedDescriptorException();
@@ -158,7 +157,7 @@ final class SysVShm extends Shm
         if (owner) {
             int rc = unlink0(fd, name);
             if (rc != 0)
-                throw new SystemException(Status.describe(rc));
+                throw new IOException(Status.describe(rc));
         }
         fd = -1;
     }

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java Fri Apr 29 07:05:36 2011
@@ -22,7 +22,7 @@ import org.apache.commons.runtime.Alread
 import org.apache.commons.runtime.InvalidArgumentException;
 import org.apache.commons.runtime.NoSuchObjectException;
 import org.apache.commons.runtime.SystemException;
-import org.apache.commons.runtime.io.RuntimeIOException;
+import java.io.IOException;
 
 /**
  * WindowsMutex class.
@@ -72,18 +72,20 @@ final class WindowsMutex extends Mutex
         this.owner = owner;
     }
 
+    @Override
     public void acquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
         int rc = Win32.WaitForSingleObject(handle, Win32.INFINITE);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public boolean tryAcquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
@@ -92,27 +94,29 @@ final class WindowsMutex extends Mutex
             return true;
         if (rc == Errno.EBUSY)
             return false;
-        throw new SystemException(Status.describe(rc));
+        throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void release()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
         int rc = release0(handle);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void close()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
         int rc = Win32.CloseHandle(handle);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
         handle = 0;
     }
 

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java Fri Apr 29 07:05:36 2011
@@ -22,7 +22,7 @@ import org.apache.commons.runtime.Invali
 import org.apache.commons.runtime.NoSuchObjectException;
 import org.apache.commons.runtime.SystemException;
 import org.apache.commons.runtime.Status;
-import org.apache.commons.runtime.io.RuntimeIOException;
+import java.io.IOException;
 
 /**
  * WindowsSemaphore class.
@@ -79,18 +79,20 @@ final class WindowsSemaphore extends Sem
         owner = false;
     }
 
+    @Override
     public void acquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
         int rc = Win32.WaitForSingleObject(handle, Win32.INFINITE);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public boolean tryAcquire()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
@@ -99,21 +101,23 @@ final class WindowsSemaphore extends Sem
             return true;
         if (rc == Errno.EBUSY)
             return false;
-        throw new SystemException(Status.describe(rc));
+        throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void release()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
         int rc = release0(handle);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
     }
 
+    @Override
     public void clear()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         boolean once = false;
 
@@ -131,20 +135,21 @@ final class WindowsSemaphore extends Sem
                 }
                 else {
                     // Not an owner
-                    throw new SystemException(Status.describe(rc));
+                    throw new IOException(Status.describe(rc));
                 }
             }
         }
     }
 
+    @Override
     public void close()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
         int rc = Win32.CloseHandle(handle);
         if (rc != 0)
-            throw new SystemException(Status.describe(rc));
+            throw new IOException(Status.describe(rc));
         handle = 0;
     }
 

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java Fri Apr 29 07:05:36 2011
@@ -24,7 +24,6 @@ import org.apache.commons.runtime.Invali
 import org.apache.commons.runtime.NoSuchObjectException;
 import org.apache.commons.runtime.SystemException;
 import org.apache.commons.runtime.io.Syncable;
-import org.apache.commons.runtime.io.RuntimeIOException;
 import org.apache.commons.runtime.io.ClosedDescriptorException;
 import java.io.IOException;
 import java.io.SyncFailedException;
@@ -125,7 +124,7 @@ final class WindowsShm extends Shm
 
     @Override
     public final Pointer attach(long addr, boolean readOnly)
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
@@ -144,7 +143,7 @@ final class WindowsShm extends Shm
 
     @Override
     public final void detach()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();
@@ -152,7 +151,7 @@ final class WindowsShm extends Shm
             if (base != 0L) {
                 int rc = Win32.UnmapViewOfFile(base);
                 if (rc != 0)
-                    throw new SystemException(Status.describe(rc));
+                    throw new IOException(Status.describe(rc));
                 base = 0L;
                 bptr = null;
             }
@@ -183,7 +182,7 @@ final class WindowsShm extends Shm
 
     @Override
     public final void close()
-        throws RuntimeIOException, SystemException
+        throws IOException
     {
         if (handle == 0)
             throw new InvalidHandleException();

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h Fri Apr 29 07:05:36 2011
@@ -40,11 +40,12 @@ enum {
     ACR_EX_ENOMEM,          /* java/lang/OutOfMemoryError */
     ACR_EX_ENULL,           /* java/lang/NullPointerException */
     ACR_EX_ENOSYS,          /* java/lang/UnsupportedOperationException */
-    
+    ACR_EX_EIO,             /* java/io/IOException */
+
+    ACR_EX_EBADF,           /* io/InvalidDescriptorException */
     ACR_EX_EACCES,          /* AccessDeniedException */
     ACR_EX_EEXIST,          /* AlreadyExistsException */
     ACR_EX_EINVAL,          /* InvalidArgumentException */
-    ACR_EX_EBADF,           /* InvalidDescriptorException */
     ACR_EX_ERANGE,          /* InvalidRangeException */
     ACR_EX_ENAMETOOLONG,    /* NameTooLongException */
     ACR_EX_ENOENT,          /* NoSuchObjectException */
@@ -1605,6 +1606,7 @@ ACR_INLINE(DWORD) AcrNetOsError()
 #endif
 #define ACR_THROW_MSG(CL, MS)   AcrThrow(env, (CL), MS)
 #define ACR_THROW_BY_ERRNO()    AcrThrowByStatus(env, ACR_GET_OS_ERROR(), 0)
+#define ACR_THROW_IO_ERRNO()    AcrThrowIoStatus(env, ACR_GET_OS_ERROR(), 0)
 
 #ifdef __cplusplus
 extern "C" {
@@ -1621,6 +1623,8 @@ AcrThrowByName(JNI_STDENV, const char *c
 void
 AcrThrowByStatus(JNI_STDENV, int err, const char *msg);
 void
+AcrThrowIoStatus(JNI_STDENV, int err, const char *msg);
+void
 AcrThrow(JNI_STDENV, int cls, const char *msg);
 void
 AcrThrowClass(JNI_STDENV, const char *clazz, const char *msg);

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/error.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/error.c?rev=1097705&r1=1097704&r2=1097705&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Fri Apr 29 07:05:36 2011
@@ -34,11 +34,12 @@ static struct {
     { 0, "java/lang/OutOfMemoryError"                           }, /* ENOMEM    */
     { 0, "java/lang/NullPointerException"                       }, /* EISNULL   */
     { 0, "java/lang/UnsupportedOperationException"              }, /* ENOSYS    */
+    { 0, "java/io/IOException"                                  }, /* I/O Error */
 
+    { 0, ACR_IO_CP      "InvalidDescriptorException"            }, /* EBADF     */
     { 0, ACR_CLASS_PATH "AccessDeniedException"                 }, /* EACCESS   */
     { 0, ACR_CLASS_PATH "AlreadyExistsException"                }, /* EEXIST    */
     { 0, ACR_CLASS_PATH "InvalidArgumentException"              }, /* EINVAL    */
-    { 0, ACR_CLASS_PATH "InvalidDescriptorException"            }, /* EBADF     */
     { 0, ACR_CLASS_PATH "InvalidRangeException"                 }, /* ERANGE    */
     { 0, ACR_CLASS_PATH "NameTooLongException"                  }, /* ENAMETOOLONG  */
     { 0, ACR_CLASS_PATH "NoSuchObjectException"                 }, /* ENOENT    */
@@ -739,10 +740,10 @@ AcrReleaseExceptionClasses(JNI_STDENV)
     }
 }
 
-void
-AcrThrowByStatus(JNI_STDENV, int err, const char *msg)
+static void
+_cr_throw_ex(JNI_STDENV, int def, int err, const char *msg)
 {
-    int cls = ACR_EX_ESYS;
+    int cls = def;
 
     if (ACR_STATUS_IS_EEXIST(err))
         cls = ACR_EX_EEXIST;
@@ -771,6 +772,18 @@ AcrThrowByStatus(JNI_STDENV, int err, co
     AcrThrow(env, cls, msg);
 }
 
+void
+AcrThrowByStatus(JNI_STDENV, int err, const char *msg)
+{
+    _cr_throw_ex(env, ACR_EX_ESYS, err, msg);
+}
+
+void
+AcrThrowIoStatus(JNI_STDENV, int err, const char *msg)
+{
+    _cr_throw_ex(env, ACR_EX_EIO, err, msg);
+}
+
 ACR_JNI_EXPORT(jint, Status, init0)(JNI_STDARGS)
 {
     return ACR_OS_LAST_CANONERR - ACR_OS_START_CANONERR;