Author: mturk Date: Mon Apr 25 14:12:56 2011 New Revision: 1096487 URL: http://svn.apache.org/viewvc?rev=1096487&view=rev Log: Use new exception classes
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Semaphore.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SemaphoreImpl.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/ShmImpl.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/PosixMutexImpl.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/PosixSemaphoreImpl.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShmImpl.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/WindowsMutexImpl.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/WindowsSemaphoreImpl.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShmImpl.java 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -40,26 +40,24 @@ public abstract class Semaphore protected boolean owner; public static Semaphore create(String name, int value) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { if (impl == null) - throw new UnsupportedOperationException(Local.sm.get("semaphore.ENOTIMPL")); + throw new OperationNotImplementedException(Local.sm.get("semaphore.ENOTIMPL")); return impl.create(name, value); } public static Semaphore open(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { if (impl == null) - throw new UnsupportedOperationException(Local.sm.get("semaphore.ENOTIMPL")); + throw new OperationNotImplementedException(Local.sm.get("semaphore.ENOTIMPL")); return impl.open(name); } @@ -72,10 +70,10 @@ public abstract class Semaphore * @param name Semaphore to destroy. */ public static boolean remove(String name) - throws NullPointerException + throws InvalidArgumentException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); return unlink0(name); } Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SemaphoreImpl.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SemaphoreImpl.java?rev=1096487&r1=1096486&r2=1096487&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SemaphoreImpl.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SemaphoreImpl.java Mon Apr 25 14:12:56 2011 @@ -38,23 +38,21 @@ public abstract class SemaphoreImpl } public static final SemaphoreImpl get() - throws UnsupportedOperationException + throws OperationNotImplementedException { if (impl == null) - throw new UnsupportedOperationException(Local.sm.get("semaphore.ENOTIMPL")); + throw new OperationNotImplementedException(Local.sm.get("semaphore.ENOTIMPL")); return impl; } public abstract Semaphore create(String name, int value) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException; public abstract Semaphore open(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException; 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -43,26 +43,24 @@ public abstract class Shm implements Syn protected long size; public static Shm create(String name, long size) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { if (impl == null) - throw new UnsupportedOperationException(Local.sm.get("sharedmem.ENOTIMPL")); + throw new OperationNotImplementedException(Local.sm.get("sharedmem.ENOTIMPL")); return impl.create(name, size); } public static Shm open(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { if (impl == null) - throw new UnsupportedOperationException(Local.sm.get("sharedmem.ENOTIMPL")); + throw new OperationNotImplementedException(Local.sm.get("sharedmem.ENOTIMPL")); return impl.open(name); } Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ShmImpl.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ShmImpl.java?rev=1096487&r1=1096486&r2=1096487&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ShmImpl.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ShmImpl.java Mon Apr 25 14:12:56 2011 @@ -47,14 +47,12 @@ public abstract class ShmImpl public abstract Shm create(String name, long size) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException; public abstract Shm open(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException; 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -15,9 +15,11 @@ */ package org.apache.commons.runtime.platform.unix; +import org.apache.commons.runtime.Errno; import org.apache.commons.runtime.Mutex; import org.apache.commons.runtime.Status; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.ClosedDescriptorException; import org.apache.commons.runtime.SystemException; @@ -38,13 +40,11 @@ final class FcntlMutex extends Mutex } private static native int close0(int fd); private static native int create0(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException; private static native int open0(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException; @@ -56,15 +56,13 @@ final class FcntlMutex extends Mutex private int fd; public FcntlMutex(final String name, boolean owner) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, NoSuchObjectException, - UnsupportedOperationException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); this.name = name; if (owner) fd = create0(this.name); @@ -91,7 +89,7 @@ final class FcntlMutex extends Mutex int rc = try0(fd); if (rc == 0) return true; - if (Status.IS_EBUSY(rc)) + else if (rc == Errno.EBUSY) return false; throw new SystemException(Status.describe(rc)); } 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -18,7 +18,9 @@ package org.apache.commons.runtime.platf import org.apache.commons.runtime.Mutex; import org.apache.commons.runtime.Semaphore; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; +import org.apache.commons.runtime.OperationNotImplementedException; import org.apache.commons.runtime.SystemException; /** @@ -39,11 +41,10 @@ final class PosixMutex extends Mutex PosixSemaphore mutex; public PosixMutex(final String name, boolean owner) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, NoSuchObjectException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { if (owner) Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutexImpl.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutexImpl.java?rev=1096487&r1=1096486&r2=1096487&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutexImpl.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixMutexImpl.java Mon Apr 25 14:12:56 2011 @@ -19,7 +19,9 @@ import org.apache.commons.runtime.Mutex; import org.apache.commons.runtime.MutexImpl; import org.apache.commons.runtime.MutexType; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; +import org.apache.commons.runtime.OperationNotImplementedException; import org.apache.commons.runtime.SystemException; /** @@ -45,10 +47,9 @@ final class PosixMutexImpl extends Mutex private static MutexType mtype; public Mutex create(MutexType type, String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { if (type == MutexType.DEFAULT) @@ -61,14 +62,13 @@ final class PosixMutexImpl extends Mutex case FCNTL: return new FcntlMutex(name, true); } - throw new UnsupportedOperationException(); + throw new OperationNotImplementedException(); } public Mutex open(MutexType type, String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { if (type == MutexType.DEFAULT) @@ -81,7 +81,7 @@ final class PosixMutexImpl extends Mutex case FCNTL: return new FcntlMutex(name, false); } - throw new UnsupportedOperationException(); + throw new OperationNotImplementedException(); } } 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -19,6 +19,8 @@ import org.apache.commons.runtime.Errno; import org.apache.commons.runtime.Semaphore; import org.apache.commons.runtime.Status; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; +import org.apache.commons.runtime.NameTooLongException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.ClosedDescriptorException; import org.apache.commons.runtime.SystemException; @@ -40,13 +42,11 @@ final class PosixSemaphore extends Semap private static native int unlink0(String name); private static native long create0(String name, int value) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException; private static native long open0(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException; @@ -67,13 +67,12 @@ final class PosixSemaphore extends Semap } public PosixSemaphore(final String name, int value) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); this.name = posixObjectName(name); while (true) { @@ -81,7 +80,7 @@ final class PosixSemaphore extends Semap sd = create0(this.name, value); break; } - catch (IllegalArgumentException e) { + catch (NameTooLongException e) { try { this.name = this.name.substring(0, 13); } @@ -94,13 +93,12 @@ final class PosixSemaphore extends Semap } public PosixSemaphore(final String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); this.name = posixObjectName(name); sd = open0(this.name); Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphoreImpl.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphoreImpl.java?rev=1096487&r1=1096486&r2=1096487&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphoreImpl.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixSemaphoreImpl.java Mon Apr 25 14:12:56 2011 @@ -18,6 +18,7 @@ package org.apache.commons.runtime.platf import org.apache.commons.runtime.Semaphore; import org.apache.commons.runtime.SemaphoreImpl; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.SystemException; @@ -37,8 +38,7 @@ final class PosixSemaphoreImpl extends S } public Semaphore create(String name, int value) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException { @@ -46,8 +46,7 @@ final class PosixSemaphoreImpl extends S } public Semaphore open(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException { Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShmImpl.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShmImpl.java?rev=1096487&r1=1096486&r2=1096487&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShmImpl.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixShmImpl.java Mon Apr 25 14:12:56 2011 @@ -19,6 +19,7 @@ import org.apache.commons.runtime.Limits import org.apache.commons.runtime.Shm; import org.apache.commons.runtime.ShmImpl; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.SystemException; @@ -38,19 +39,17 @@ final class PosixShmImpl extends ShmImpl } public Shm create(String name, long size) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException { if (size < Limits.SHMMIN || size > Limits.SHMMAX) - throw new IllegalArgumentException("Shared memory size is outside the limits."); + throw new InvalidArgumentException("Shared memory size is outside the limits."); return new SysVShm(name, size); } public Shm open(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException { 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -19,7 +19,9 @@ import org.apache.commons.runtime.Mutex; import org.apache.commons.runtime.Status; import org.apache.commons.runtime.AlreadyExistsException; import org.apache.commons.runtime.NoSuchObjectException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.ClosedDescriptorException; +import org.apache.commons.runtime.OperationNotImplementedException; import org.apache.commons.runtime.SystemException; /** @@ -38,13 +40,11 @@ final class SysVMutex extends Mutex } private static native int close0(int fd); private static native int create0(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException; private static native int open0(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException; @@ -56,11 +56,10 @@ final class SysVMutex extends Mutex private int fd; public SysVMutex(final String name, boolean owner) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, NoSuchObjectException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { if (name == null) 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -19,6 +19,7 @@ import org.apache.commons.runtime.Pointe import org.apache.commons.runtime.Shm; import org.apache.commons.runtime.Status; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.ClosedDescriptorException; import org.apache.commons.runtime.SystemException; @@ -40,13 +41,11 @@ final class SysVShm extends Shm } private static native int create0(String name, long size) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException; private static native int open0(String name, long[] size) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException; @@ -61,13 +60,12 @@ final class SysVShm extends Shm private Pointer bptr; public SysVShm(final String name, long size) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException("Shared memory name cannot be null"); this.name = name; this.size = size; fd = create0(this.name, this.size); @@ -75,13 +73,12 @@ final class SysVShm extends Shm } public SysVShm(final String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException("Shared memory name cannot be null"); this.name = name; long[] sa = new long[1]; fd = open0(this.name, sa); 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -19,6 +19,7 @@ import org.apache.commons.runtime.Errno; import org.apache.commons.runtime.Mutex; import org.apache.commons.runtime.Status; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.ClosedDescriptorException; import org.apache.commons.runtime.SystemException; @@ -41,24 +42,23 @@ final class WindowsMutex extends Mutex private int handle; private static native int create0(String name, long sd) - throws IllegalAccessException, + throws InvalidArgumentException, AlreadyExistsException, SystemException; private static native int open0(String name) - throws IllegalAccessException, + throws InvalidArgumentException, NoSuchObjectException, SystemException; private static native int release0(int mtx); public WindowsMutex(final String name, boolean owner) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, NoSuchObjectException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); this.name = "Global\\" + name.replace('\\', '_'); if (owner) { long s = Security.stdSecurityDescriptor(Win32.MUTEX_ALL_ACCESS | Win32.GENERIC_RWX, Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutexImpl.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutexImpl.java?rev=1096487&r1=1096486&r2=1096487&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutexImpl.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutexImpl.java Mon Apr 25 14:12:56 2011 @@ -19,7 +19,9 @@ import org.apache.commons.runtime.Mutex; import org.apache.commons.runtime.MutexImpl; import org.apache.commons.runtime.MutexType; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; +import org.apache.commons.runtime.OperationNotImplementedException; import org.apache.commons.runtime.SystemException; /** @@ -38,31 +40,29 @@ final class WindowsMutexImpl extends Mut } public Mutex create(MutexType type, String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { switch (type) { case DEFAULT: return new WindowsMutex(name, true); } - throw new UnsupportedOperationException(); + throw new OperationNotImplementedException(); } public Mutex open(MutexType type, String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, - UnsupportedOperationException, + OperationNotImplementedException, SystemException { switch (type) { case DEFAULT: return new WindowsMutex(name, false); } - throw new UnsupportedOperationException(); + throw new OperationNotImplementedException(); } } 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -18,8 +18,9 @@ package org.apache.commons.runtime.platf import org.apache.commons.runtime.Errno; import org.apache.commons.runtime.Semaphore; import org.apache.commons.runtime.AlreadyExistsException; -import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.ClosedDescriptorException; +import org.apache.commons.runtime.InvalidArgumentException; +import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.SystemException; import org.apache.commons.runtime.Status; @@ -42,23 +43,22 @@ final class WindowsSemaphore extends Sem private int handle; private static native int create0(String name, int value, long sd) - throws IllegalAccessException, + throws InvalidArgumentException, AlreadyExistsException, SystemException; private static native int open0(String name) - throws IllegalAccessException, + throws InvalidArgumentException, NoSuchObjectException, SystemException; private static native int release0(int sema); public WindowsSemaphore(final String name, int value) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); this.name = "Global\\" + name.replace('\\', '_'); long sa = Security.stdSecurityDescriptor(Win32.SEMAPHORE_ALL_ACCESS | Win32.GENERIC_RWX, Win32.SEMAPHORE_ALL_ACCESS | Win32.GENERIC_RWX, @@ -68,13 +68,12 @@ final class WindowsSemaphore extends Sem } public WindowsSemaphore(final String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); this.name = "Global\\" + name.replace('\\', '_'); handle = open0(this.name); owner = false; Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphoreImpl.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphoreImpl.java?rev=1096487&r1=1096486&r2=1096487&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphoreImpl.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphoreImpl.java Mon Apr 25 14:12:56 2011 @@ -18,6 +18,7 @@ package org.apache.commons.runtime.platf import org.apache.commons.runtime.Semaphore; import org.apache.commons.runtime.SemaphoreImpl; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.SystemException; @@ -37,8 +38,7 @@ final class WindowsSemaphoreImpl extends } public Semaphore create(String name, int value) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException { @@ -46,8 +46,7 @@ final class WindowsSemaphoreImpl extends } public Semaphore open(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException { 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=1096487&r1=1096486&r2=1096487&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 Mon Apr 25 14:12:56 2011 @@ -20,6 +20,7 @@ import org.apache.commons.runtime.Pointe import org.apache.commons.runtime.Shm; import org.apache.commons.runtime.Status; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.ClosedDescriptorException; import org.apache.commons.runtime.SystemException; @@ -49,13 +50,12 @@ final class WindowsShm extends Shm private Pointer bptr; public WindowsShm(final String name, long size) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); this.name = "Global\\" + name.replace('\\', '_'); this.size = size; handle = Win32.CreateFileMapping(Win32.INVALID_HANDLE_VALUE, @@ -82,13 +82,12 @@ final class WindowsShm extends Shm } public WindowsShm(final String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException { if (name == null) - throw new NullPointerException(); + throw new InvalidArgumentException(); this.name = "Global\\" + name.replace('\\', '_'); handle = Win32.OpenFileMapping(Win32.FILE_MAP_READ | Win32.FILE_MAP_WRITE, false, Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShmImpl.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShmImpl.java?rev=1096487&r1=1096486&r2=1096487&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShmImpl.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShmImpl.java Mon Apr 25 14:12:56 2011 @@ -19,6 +19,7 @@ import org.apache.commons.runtime.Limits import org.apache.commons.runtime.Shm; import org.apache.commons.runtime.ShmImpl; import org.apache.commons.runtime.AlreadyExistsException; +import org.apache.commons.runtime.InvalidArgumentException; import org.apache.commons.runtime.NoSuchObjectException; import org.apache.commons.runtime.SystemException; @@ -38,19 +39,17 @@ final class WindowsShmImpl extends ShmIm } public Shm create(String name, long size) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, AlreadyExistsException, SystemException { if (size < Limits.SHMMIN || size > Limits.SHMMAX) - throw new IllegalArgumentException("Shared memory size is outside the limits."); + throw new InvalidArgumentException("Shared memory size is outside the limits."); return new WindowsShm(name, size); } public Shm open(String name) - throws IllegalAccessException, - IllegalArgumentException, + throws InvalidArgumentException, NoSuchObjectException, SystemException {