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/26 08:54:25 UTC
svn commit: r1096674 - 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/os/unix/
native/shared/
Author: mturk
Date: Tue Apr 26 06:54:24 2011
New Revision: 1096674
URL: http://svn.apache.org/viewvc?rev=1096674&view=rev
Log:
Add execmem stubs
Added:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemory.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemoryImpl.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixExecutableMemoryImpl.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsExecutableMemoryImpl.java (with props)
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Mutex.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/MutexImpl.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ReflectedMethod.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/TimeoutException.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/InvalidHandleException.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.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/os/unix/shmem.c
commons/sandbox/runtime/trunk/src/main/native/shared/error.c
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemory.java?rev=1096674&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemory.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemory.java Tue Apr 26 06:54:24 2011
@@ -0,0 +1,71 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.runtime;
+
+/**
+ * ExecutableMemory class.
+ * <p>
+ * </p>
+ *
+ * @since Runtime 1.0
+ */
+public final class ExecutableMemory
+{
+ private static final ExecutableMemoryImpl impl;
+
+ static {
+ impl = ExecutableMemoryImpl.get();
+ }
+
+ private ExecutableMemory()
+ {
+ // No Instance
+ }
+
+ /**
+ * Allocates {@code size} bytes and returns a {@link Pointer}
+ * to the allocated memory. The memory is not cleared.
+ *
+ * @param size Size of the memory to allocate.
+ * @return new {@link Pointer} containing memory area.
+ *
+ * @throws OutOfMemoryError if memory cannot be allocated.
+ * @throws InvalidArgumentException if the size is less then {@code 1}.
+ */
+ public static final Pointer malloc(long size)
+ throws OutOfMemoryError, InvalidArgumentException
+ {
+ return impl.malloc(size);
+ }
+
+ /**
+ * Allocates {@code size} bytes and returns a {@link Pointer}
+ * to the allocated memory. The memory is cleared.
+ *
+ * @param size Size of the memory to allocate.
+ * @return new {@link Pointer} containing memory area.
+ *
+ * @throws OutOfMemoryError if memory cannot be allocated.
+ * @throws InvalidArgumentException if the size is less then {@code 1}.
+ */
+ public static final Pointer calloc(long size)
+ throws OutOfMemoryError, InvalidArgumentException
+ {
+ return impl.calloc(size);
+ }
+
+}
+
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemoryImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemoryImpl.java?rev=1096674&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemoryImpl.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemoryImpl.java Tue Apr 26 06:54:24 2011
@@ -0,0 +1,75 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.runtime;
+
+/**
+ * ExecutableMemoryImpl class.
+ * <p>
+ * </p>
+ *
+ * @since Runtime 1.0
+ */
+public abstract class ExecutableMemoryImpl
+{
+ private static final ExecutableMemoryImpl impl;
+ private static native ExecutableMemoryImpl init0()
+ throws OutOfMemoryError;
+
+ static {
+ impl = init0();
+ }
+
+ protected ExecutableMemoryImpl()
+ {
+ // No Instance
+ }
+
+ public static final ExecutableMemoryImpl get()
+ throws OperationNotImplementedException
+ {
+ if (impl == null)
+ throw new OperationNotImplementedException(Local.sm.get("execmem.ENOTIMPL"));
+ return impl;
+ }
+
+ /**
+ * Allocates {@code size} bytes and returns a {@link Pointer}
+ * to the allocated memory. The memory is not cleared.
+ *
+ * @param size Size of the memory to allocate.
+ * @return new {@link Pointer} containing memory area.
+ *
+ * @throws OutOfMemoryError if memory cannot be allocated.
+ * @throws InvalidArgumentException if the size is less then {@code 1}.
+ */
+ public abstract Pointer malloc(long size)
+ throws OutOfMemoryError, InvalidArgumentException;
+
+ /**
+ * Allocates {@code size} bytes and returns a {@link Pointer}
+ * to the allocated memory. The memory is cleared.
+ *
+ * @param size Size of the memory to allocate.
+ * @return new {@link Pointer} containing memory area.
+ *
+ * @throws OutOfMemoryError if memory cannot be allocated.
+ * @throws InvalidArgumentException if the size is less then {@code 1}.
+ */
+ public abstract Pointer calloc(long size)
+ throws OutOfMemoryError, InvalidArgumentException;
+
+}
+
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ExecutableMemoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties?rev=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/LocalStrings.properties Tue Apr 26 06:54:24 2011
@@ -19,3 +19,4 @@ mutextype.EINVAL=Invalid MutexType enum
mutex.ENOTIMPL=Apache Commons Runtime does not support mutexes on this platform
sharedmem.ENOTIMPL=Apache Commons Runtime does not support shared memory on this platform
semaphore.ENOTIMPL=Apache Commons Runtime does not support semaphores on this platform
+execmem.ENOTIMPL=Apache Commons Runtime does not support executable memory on this platform
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java?rev=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Memory.java Tue Apr 26 06:54:24 2011
@@ -147,10 +147,10 @@ public final class Memory
* @return new {@link Pointer} containing memory area.
*
* @throws OutOfMemoryError if memory cannot be allocated.
- * @throws IllegalArgumentException if the size is less then {@code 1}.
+ * @throws InvalidArgumentException if the size is less then {@code 1}.
*/
public static native Pointer malloc(long size)
- throws OutOfMemoryError, IllegalArgumentException;
+ throws OutOfMemoryError, InvalidArgumentException;
/**
* Allocates {@code size} bytes and returns a {@link Pointer}
@@ -160,10 +160,10 @@ public final class Memory
* @return new {@link Pointer} containing memory area.
*
* @throws OutOfMemoryError if memory cannot be allocated.
- * @throws IllegalArgumentException if the size is less then {@code 1}.
+ * @throws InvalidArgumentException if the size is less then {@code 1}.
*/
public static native Pointer calloc(long size)
- throws OutOfMemoryError, IllegalArgumentException;
+ throws OutOfMemoryError, InvalidArgumentException;
private static native long realloc0(long addr, long size)
throws RuntimeException;
@@ -180,14 +180,14 @@ public final class Memory
* @param size The new size of the memory block.
*
* @throws OutOfMemoryError if memory cannot be allocated.
- * @throws IllegalArgumentException if the size is less then {@code 1}.
+ * @throws InvalidArgumentException if the size is less then {@code 1}.
* @throws RuntimeException if the {@code ptr} points to an invalid address.
*/
public static void realloc(Pointer ptr, long size)
- throws OutOfMemoryError, IllegalArgumentException, RuntimeException
+ throws OutOfMemoryError, InvalidArgumentException, RuntimeException
{
if (size < 1L)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
long p = realloc0(ptr.POINTER, size);
if (p == 0L)
throw new OutOfMemoryError("Memory re-allocation failed");
@@ -262,20 +262,20 @@ public final class Memory
* @param size size of the destination memory.
* @return new {@link Pointer}.
*
- * @throws IllegalArgumentException if the {@code offset} is
+ * @throws InvalidArgumentException if the {@code offset} is
* {@code negative} or {@code size} is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
* access of data outside allocated memory bounds.
* @throws NullPointerException if {@code src} is {@code null}.
*/
public static Pointer slice(Pointer src, long offset, long size)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException
{
if (src == null)
throw new NullPointerException();
if (offset < 0L || size < 1L)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (src.POINTER == 0L)
throw new NullPointerException();
if (offset + size > src.PLENGTH)
@@ -297,7 +297,7 @@ public final class Memory
* @param size size of the destination memory.
* @return new {@link Pointer}.
*
- * @throws IllegalArgumentException if the {@code offset} is
+ * @throws InvalidArgumentException if the {@code offset} is
* {@code negative} or {@code size} is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
* access of data outside allocated memory bounds.
@@ -306,13 +306,13 @@ public final class Memory
* @throws OutOfMemoryError if memory cannot be dipicated.
*/
public static Pointer dup(Pointer src, long offset, long size)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, RuntimeException, OutOfMemoryError
{
if (src == null || src.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || size < 1L)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (offset + size > src.PLENGTH)
throw new IndexOutOfBoundsException();
@@ -335,7 +335,7 @@ public final class Memory
* @param dstPos starting position in the destination memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -348,7 +348,7 @@ public final class Memory
*/
public static void copy(Pointer src, long srcPos, Pointer dst,
long dstPos, long length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, RuntimeException,
UnsupportedOperationException
{
@@ -357,7 +357,7 @@ public final class Memory
if (src.POINTER == 0L || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0L || length < 1L)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dst.isConst())
throw new UnsupportedOperationException();
if (srcPos + length > src.PLENGTH)
@@ -382,7 +382,7 @@ public final class Memory
* @param dstPos starting position in the destination memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -395,7 +395,7 @@ public final class Memory
*/
public static void move(Pointer src, long srcPos, Pointer dst,
long dstPos, long length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, RuntimeException,
UnsupportedOperationException
{
@@ -404,7 +404,7 @@ public final class Memory
if (src.POINTER == 0L || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0L || length < 1L)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dst.isConst())
throw new UnsupportedOperationException();
if (srcPos + length > src.PLENGTH)
@@ -423,7 +423,7 @@ public final class Memory
* @param offset starting position in the memory.
* @param length the number of bytes to be clear.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -434,14 +434,14 @@ public final class Memory
* instance of {@code ConstPointer}.
*/
public static void clear(Pointer ptr, long offset, long length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, RuntimeException,
UnsupportedOperationException
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1L)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (ptr.isConst())
throw new UnsupportedOperationException();
if (offset + length > ptr.PLENGTH)
@@ -459,7 +459,7 @@ public final class Memory
* @param length the number of bytes to be set.
* @param val value to set.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -470,14 +470,14 @@ public final class Memory
* instance of {@code ConstPointer}.
*/
public static void set(Pointer ptr, long offset, long length, int val)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, RuntimeException,
UnsupportedOperationException
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1L)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (ptr.isConst())
throw new UnsupportedOperationException();
if (offset + length > ptr.PLENGTH)
@@ -495,7 +495,7 @@ public final class Memory
* @param length the number of bytes use.
* @return new {@code byte} array with values from {@code src} memory area.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -504,13 +504,13 @@ public final class Memory
* @throws OutOfMemoryError if memory cannot be dipicated.
*/
public static byte[] toByteArray(Pointer ptr, long offset, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, OutOfMemoryError
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (offset + length > ptr.PLENGTH)
throw new IndexOutOfBoundsException();
@@ -527,7 +527,7 @@ public final class Memory
* @param length the number of chars use.
* @return new {@code char} array with values from {@code src} memory area.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -536,13 +536,13 @@ public final class Memory
* @throws OutOfMemoryError if memory cannot be dipicated.
*/
public static char[] toCharArray(Pointer ptr, long offset, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, OutOfMemoryError
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (((offset + length) * 2) > ptr.PLENGTH)
throw new IndexOutOfBoundsException();
@@ -559,7 +559,7 @@ public final class Memory
* @param length the number of chars use.
* @return new {@code short} array with values from {@code src} memory area.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -568,13 +568,13 @@ public final class Memory
* @throws OutOfMemoryError if memory cannot be dipicated.
*/
public static short[] toShortArray(Pointer ptr, long offset, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, OutOfMemoryError
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (((offset + length) * 2) > ptr.PLENGTH)
throw new IndexOutOfBoundsException();
@@ -591,7 +591,7 @@ public final class Memory
* @param length the number of chars use.
* @return new {@code int} array with values from {@code src} memory area.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -600,13 +600,13 @@ public final class Memory
* @throws OutOfMemoryError if memory cannot be dipicated.
*/
public static int[] toIntArray(Pointer ptr, long offset, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, OutOfMemoryError
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (((offset + length) * 4) > ptr.PLENGTH)
throw new IndexOutOfBoundsException();
@@ -624,7 +624,7 @@ public final class Memory
* @param length the number of chars use.
* @return new {@code long} array with values from {@code src} memory area.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -633,13 +633,13 @@ public final class Memory
* @throws OutOfMemoryError if memory cannot be dipicated.
*/
public static long[] toLongArray(Pointer ptr, long offset, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, OutOfMemoryError
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (((offset + length) * 8) > ptr.PLENGTH)
throw new IndexOutOfBoundsException();
@@ -657,7 +657,7 @@ public final class Memory
* @param length the number of chars use.
* @return new {@code long} array with values from {@code src} memory area.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -666,13 +666,13 @@ public final class Memory
* @throws OutOfMemoryError if memory cannot be dipicated.
*/
public static float[] toFloatArray(Pointer ptr, long offset, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, OutOfMemoryError
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (((offset + length) * 4) > ptr.PLENGTH)
throw new IndexOutOfBoundsException();
@@ -690,7 +690,7 @@ public final class Memory
* @param length the number of chars use.
* @return new {@code long} array with values from {@code src} memory area.
*
- * @throws IllegalArgumentException if the {@code offset}
+ * @throws InvalidArgumentException if the {@code offset}
* is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -699,13 +699,13 @@ public final class Memory
* @throws OutOfMemoryError if memory cannot be dipicated.
*/
public static double[] toDoubleArray(Pointer ptr, long offset, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, OutOfMemoryError
{
if (ptr == null || ptr.POINTER == 0L)
throw new NullPointerException();
if (offset < 0L || length < 1)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (((offset + length) * 8) > ptr.PLENGTH)
throw new IndexOutOfBoundsException();
@@ -725,7 +725,7 @@ public final class Memory
* @param dstPos starting position in the destination array.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -735,13 +735,13 @@ public final class Memory
*/
public static void copy(Pointer src, long srcPos, byte[] dst,
int dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException
{
if (src == null || src.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0 || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > dst.length)
throw new ArrayIndexOutOfBoundsException();
if (srcPos + length > src.PLENGTH)
@@ -763,7 +763,7 @@ public final class Memory
* @param dstPos starting position in the destination array.
* @param length the number of chars to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -773,13 +773,13 @@ public final class Memory
*/
public static void copy(Pointer src, long srcPos, char[] dst,
int dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException
{
if (src == null || src.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0 || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > dst.length)
throw new ArrayIndexOutOfBoundsException();
if (((srcPos + length) * 2) > src.PLENGTH)
@@ -801,7 +801,7 @@ public final class Memory
* @param dstPos starting position in the destination array.
* @param length the number of shorts to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -811,13 +811,13 @@ public final class Memory
*/
public static void copy(Pointer src, long srcPos, short[] dst,
int dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException
{
if (src == null || src.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0 || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > dst.length)
throw new ArrayIndexOutOfBoundsException();
if (((srcPos + length) * 2) > src.PLENGTH)
@@ -839,7 +839,7 @@ public final class Memory
* @param dstPos starting position in the destination array.
* @param length the number of ints to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -849,13 +849,13 @@ public final class Memory
*/
public static void copy(Pointer src, long srcPos, int[] dst,
int dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException
{
if (src == null || src.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0 || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > dst.length)
throw new ArrayIndexOutOfBoundsException();
if (((srcPos + length) * 4) > src.PLENGTH)
@@ -877,7 +877,7 @@ public final class Memory
* @param dstPos starting position in the destination array.
* @param length the number of longs to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -887,13 +887,13 @@ public final class Memory
*/
public static void copy(Pointer src, long srcPos, long[] dst,
int dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException
{
if (src == null || src.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0 || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > dst.length)
throw new ArrayIndexOutOfBoundsException();
if (((srcPos + length) * 8) > src.PLENGTH)
@@ -915,7 +915,7 @@ public final class Memory
* @param dstPos starting position in the destination array.
* @param length the number of longs to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -925,13 +925,13 @@ public final class Memory
*/
public static void copy(Pointer src, long srcPos, float[] dst,
int dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException
{
if (src == null || src.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0 || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > dst.length)
throw new ArrayIndexOutOfBoundsException();
if (((srcPos + length) * 4) > src.PLENGTH)
@@ -953,7 +953,7 @@ public final class Memory
* @param dstPos starting position in the destination array.
* @param length the number of longs to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -963,13 +963,13 @@ public final class Memory
*/
public static void copy(Pointer src, long srcPos, double[] dst,
int dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException
{
if (src == null || src.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0L || dstPos < 0 || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > dst.length)
throw new ArrayIndexOutOfBoundsException();
if (((srcPos + length) * 8) > src.PLENGTH)
@@ -991,7 +991,7 @@ public final class Memory
* @param dstPos starting position in the source memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -1003,13 +1003,13 @@ public final class Memory
*/
public static void copy(byte[] src, int srcPos, Pointer dst,
long dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, UnsupportedOperationException
{
if (dst == null || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0 || dstPos < 0L || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > src.length)
throw new ArrayIndexOutOfBoundsException();
if (dstPos + length > dst.PLENGTH)
@@ -1032,7 +1032,7 @@ public final class Memory
* @param dstPos starting position in the source memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -1044,13 +1044,13 @@ public final class Memory
*/
public static void copy(char[] src, int srcPos, Pointer dst,
long dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, UnsupportedOperationException
{
if (dst == null || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0 || dstPos < 0L || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > src.length)
throw new ArrayIndexOutOfBoundsException();
if (((dstPos + length) * 2) > dst.PLENGTH)
@@ -1073,7 +1073,7 @@ public final class Memory
* @param dstPos starting position in the source memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -1085,13 +1085,13 @@ public final class Memory
*/
public static void copy(short[] src, int srcPos, Pointer dst,
long dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, UnsupportedOperationException
{
if (dst == null || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0 || dstPos < 0L || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > src.length)
throw new ArrayIndexOutOfBoundsException();
if (((dstPos + length) * 2) > dst.PLENGTH)
@@ -1114,7 +1114,7 @@ public final class Memory
* @param dstPos starting position in the source memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -1126,13 +1126,13 @@ public final class Memory
*/
public static void copy(int[] src, int srcPos, Pointer dst,
long dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, UnsupportedOperationException
{
if (dst == null || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0 || dstPos < 0L || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > src.length)
throw new ArrayIndexOutOfBoundsException();
if (((dstPos + length) * 4) > dst.PLENGTH)
@@ -1155,7 +1155,7 @@ public final class Memory
* @param dstPos starting position in the source memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -1167,13 +1167,13 @@ public final class Memory
*/
public static void copy(long[] src, int srcPos, Pointer dst,
long dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, UnsupportedOperationException
{
if (dst == null || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0 || dstPos < 0L || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > src.length)
throw new ArrayIndexOutOfBoundsException();
if (((dstPos + length) * 8) > dst.PLENGTH)
@@ -1196,7 +1196,7 @@ public final class Memory
* @param dstPos starting position in the source memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -1208,13 +1208,13 @@ public final class Memory
*/
public static void copy(float[] src, int srcPos, Pointer dst,
long dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, UnsupportedOperationException
{
if (dst == null || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0 || dstPos < 0L || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > src.length)
throw new ArrayIndexOutOfBoundsException();
if (((dstPos + length) * 4) > dst.PLENGTH)
@@ -1237,7 +1237,7 @@ public final class Memory
* @param dstPos starting position in the source memory.
* @param length the number of bytes to be copied.
*
- * @throws IllegalArgumentException if the {@code srcPos} or
+ * @throws InvalidArgumentException if the {@code srcPos} or
* {@code dstPos} is {@code negative} or {@code length}
* is {@code zero}.
* @throws IndexOutOfBoundsException if the operation would cause
@@ -1249,13 +1249,13 @@ public final class Memory
*/
public static void copy(double[] src, int srcPos, Pointer dst,
long dstPos, int length)
- throws IndexOutOfBoundsException, IllegalArgumentException,
+ throws IndexOutOfBoundsException, InvalidArgumentException,
NullPointerException, UnsupportedOperationException
{
if (dst == null || dst.POINTER == 0L)
throw new NullPointerException();
if (srcPos < 0 || dstPos < 0L || length == 0)
- throw new IllegalArgumentException();
+ throw new InvalidArgumentException();
if (dstPos + length > src.length)
throw new ArrayIndexOutOfBoundsException();
if (((dstPos + length) * 8) > dst.PLENGTH)
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=1096674&r1=1096673&r2=1096674&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 Tue Apr 26 06:54:24 2011
@@ -45,50 +45,50 @@ public abstract class Mutex
}
public static Mutex create(MutexType type, String name)
- throws IllegalAccessException,
- IllegalArgumentException,
+ throws AccessDeniedException,
+ InvalidArgumentException,
AlreadyExistsException,
- UnsupportedOperationException,
+ OperationNotImplementedException,
SystemException
{
if (impl == null)
- throw new UnsupportedOperationException(Local.sm.get("mutex.ENOTIMPL"));
+ throw new OperationNotImplementedException(Local.sm.get("mutex.ENOTIMPL"));
return impl.create(type, name);
}
public static Mutex create(String name)
- throws IllegalAccessException,
- IllegalArgumentException,
+ throws AccessDeniedException,
+ InvalidArgumentException,
AlreadyExistsException,
- UnsupportedOperationException,
+ OperationNotImplementedException,
SystemException
{
if (impl == null)
- throw new UnsupportedOperationException(Local.sm.get("mutex.ENOTIMPL"));
+ throw new OperationNotImplementedException(Local.sm.get("mutex.ENOTIMPL"));
return impl.create(MutexType.DEFAULT, name);
}
public static Mutex open(MutexType type, String name)
- throws IllegalAccessException,
- IllegalArgumentException,
+ throws AccessDeniedException,
+ InvalidArgumentException,
NoSuchObjectException,
- UnsupportedOperationException,
+ OperationNotImplementedException,
SystemException
{
if (impl == null)
- throw new UnsupportedOperationException(Local.sm.get("mutex.ENOTIMPL"));
+ throw new OperationNotImplementedException(Local.sm.get("mutex.ENOTIMPL"));
return impl.open(type, name);
}
public static Mutex open(String name)
- throws IllegalAccessException,
- IllegalArgumentException,
+ throws AccessDeniedException,
+ InvalidArgumentException,
NoSuchObjectException,
- UnsupportedOperationException,
+ OperationNotImplementedException,
SystemException
{
if (impl == null)
- throw new UnsupportedOperationException(Local.sm.get("mutex.ENOTIMPL"));
+ throw new OperationNotImplementedException(Local.sm.get("mutex.ENOTIMPL"));
return impl.open(MutexType.DEFAULT, name);
}
@@ -101,10 +101,10 @@ public abstract class Mutex
* @param name Mutex 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/MutexImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/MutexImpl.java?rev=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/MutexImpl.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/MutexImpl.java Tue Apr 26 06:54:24 2011
@@ -44,17 +44,17 @@ public abstract class MutexImpl
}
public abstract Mutex create(MutexType type, String name)
- throws IllegalAccessException,
- IllegalArgumentException,
+ throws AccessDeniedException,
+ InvalidArgumentException,
AlreadyExistsException,
- UnsupportedOperationException,
+ OperationNotImplementedException,
SystemException;
public abstract Mutex open(MutexType type, String name)
- throws IllegalAccessException,
- IllegalArgumentException,
+ throws AccessDeniedException,
+ InvalidArgumentException,
NoSuchObjectException,
- UnsupportedOperationException,
+ OperationNotImplementedException,
SystemException;
}
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ReflectedMethod.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ReflectedMethod.java?rev=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ReflectedMethod.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ReflectedMethod.java Tue Apr 26 06:54:24 2011
@@ -36,7 +36,7 @@ public abstract class ReflectedMethod
}
public Method toMethod()
- throws IllegalArgumentException, OutOfMemoryError
+ throws InvalidArgumentException, OutOfMemoryError
{
return Reflect.toMethod(clazz, methodID, isStatic);
}
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/TimeoutException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/TimeoutException.java?rev=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/TimeoutException.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/TimeoutException.java Tue Apr 26 06:54:24 2011
@@ -15,7 +15,6 @@
*/
package org.apache.commons.runtime;
-import java.io.IOException;
/**
* Exception thrown when a blocking operation times out. Blocking
@@ -24,10 +23,11 @@ import java.io.IOException;
* is possible to return a value that indicates timeout; when that is
* not possible or desirable then {@code TimeoutException} should be
* declared and thrown.
+ * This class mimics the os {@code ETIMEDOUT} error.
*
* @since Runtime 1.0
*/
-public class TimeoutException extends IOException
+public class TimeoutException extends SystemException
{
public TimeoutException()
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixExecutableMemoryImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixExecutableMemoryImpl.java?rev=1096674&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixExecutableMemoryImpl.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixExecutableMemoryImpl.java Tue Apr 26 06:54:24 2011
@@ -0,0 +1,53 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.runtime.platform.unix;
+
+import org.apache.commons.runtime.Pointer;
+import org.apache.commons.runtime.ExecutableMemoryImpl;
+import org.apache.commons.runtime.InvalidArgumentException;
+import org.apache.commons.runtime.SystemException;
+
+/**
+ * PosixExecutableMemoryImpl class.
+ * <p>
+ * </p>
+ *
+ * @since Runtime 1.0
+ */
+final class PosixExecutableMemoryImpl extends ExecutableMemoryImpl
+{
+
+ public PosixExecutableMemoryImpl()
+ {
+ // No Instance
+ }
+
+ @Override
+ public final Pointer malloc(long size)
+ throws OutOfMemoryError, InvalidArgumentException
+ {
+ return null;
+ }
+
+ @Override
+ public final Pointer calloc(long size)
+ throws OutOfMemoryError, InvalidArgumentException
+ {
+ return null;
+ }
+
+}
+
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/PosixExecutableMemoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/InvalidHandleException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/InvalidHandleException.java?rev=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/InvalidHandleException.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/InvalidHandleException.java Tue Apr 26 06:54:24 2011
@@ -15,7 +15,7 @@
*/
package org.apache.commons.runtime.platform.windows;
-import java.io.IOException;
+import org.apache.commons.runtime.InvalidDescriptorException;
/**
* InvalidHandleException thrown when an attempt is made to
@@ -23,7 +23,7 @@ import java.io.IOException;
*
* @since Runtime 1.0
*/
-public class InvalidHandleException extends IOException
+public class InvalidHandleException extends InvalidDescriptorException
{
public InvalidHandleException()
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java?rev=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java Tue Apr 26 06:54:24 2011
@@ -51,7 +51,7 @@ final class Security
throws SystemException;
- public static long stdSecurityDescriptor(int adminAccess, int groupAccess, int otherAccess)
+ public static long getSecurityDescriptor(int adminAccess, int groupAccess, int otherAccess)
throws SystemException
{
String aas = Utils.hex(adminAccess);
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsExecutableMemoryImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsExecutableMemoryImpl.java?rev=1096674&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsExecutableMemoryImpl.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsExecutableMemoryImpl.java Tue Apr 26 06:54:24 2011
@@ -0,0 +1,53 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.runtime.platform.unix;
+
+import org.apache.commons.runtime.Pointer;
+import org.apache.commons.runtime.ExecutableMemoryImpl;
+import org.apache.commons.runtime.InvalidArgumentException;
+import org.apache.commons.runtime.SystemException;
+
+/**
+ * WindowsExecutableMemoryImpl class.
+ * <p>
+ * </p>
+ *
+ * @since Runtime 1.0
+ */
+final class WindowsExecutableMemoryImpl extends ExecutableMemoryImpl
+{
+
+ public WindowsExecutableMemoryImpl()
+ {
+ // No Instance
+ }
+
+ @Override
+ public final Pointer malloc(long size)
+ throws OutOfMemoryError, InvalidArgumentException
+ {
+ return null;
+ }
+
+ @Override
+ public final Pointer calloc(long size)
+ throws OutOfMemoryError, InvalidArgumentException
+ {
+ return null;
+ }
+
+}
+
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsExecutableMemoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
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=1096674&r1=1096673&r2=1096674&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 Tue Apr 26 06:54:24 2011
@@ -21,7 +21,6 @@ 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;
/**
@@ -61,7 +60,7 @@ final class WindowsMutex extends Mutex
throw new InvalidArgumentException();
this.name = "Global\\" + name.replace('\\', '_');
if (owner) {
- long s = Security.stdSecurityDescriptor(Win32.MUTEX_ALL_ACCESS | Win32.GENERIC_RWX,
+ long s = Security.getSecurityDescriptor(Win32.MUTEX_ALL_ACCESS | Win32.GENERIC_RWX,
Win32.MUTEX_ALL_ACCESS | Win32.GENERIC_RWX,
Win32.MUTEX_MODIFY_STATE | Win32.GENERIC_RWR);
handle = create0(this.name, s);
@@ -76,7 +75,7 @@ final class WindowsMutex extends Mutex
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = Win32.WaitForSingleObject(handle, Win32.INFINITE);
if (rc != 0)
throw new SystemException(Status.describe(rc));
@@ -86,7 +85,7 @@ final class WindowsMutex extends Mutex
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = Win32.WaitForSingleObject(handle, 0);
if (rc == 0)
return true;
@@ -99,7 +98,7 @@ final class WindowsMutex extends Mutex
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = release0(handle);
if (rc != 0)
throw new SystemException(Status.describe(rc));
@@ -109,7 +108,7 @@ final class WindowsMutex extends Mutex
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = Win32.CloseHandle(handle);
if (rc != 0)
throw new SystemException(Status.describe(rc));
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=1096674&r1=1096673&r2=1096674&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 Tue Apr 26 06:54:24 2011
@@ -18,7 +18,6 @@ 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.ClosedDescriptorException;
import org.apache.commons.runtime.InvalidArgumentException;
import org.apache.commons.runtime.NoSuchObjectException;
import org.apache.commons.runtime.SystemException;
@@ -60,7 +59,7 @@ final class WindowsSemaphore extends Sem
if (name == null)
throw new InvalidArgumentException();
this.name = "Global\\" + name.replace('\\', '_');
- long sa = Security.stdSecurityDescriptor(Win32.SEMAPHORE_ALL_ACCESS | Win32.GENERIC_RWX,
+ long sa = Security.getSecurityDescriptor(Win32.SEMAPHORE_ALL_ACCESS | Win32.GENERIC_RWX,
Win32.SEMAPHORE_ALL_ACCESS | Win32.GENERIC_RWX,
Win32.SEMAPHORE_MODIFY_STATE | Win32.GENERIC_RWR);
handle = create0(this.name, value, sa);
@@ -83,7 +82,7 @@ final class WindowsSemaphore extends Sem
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = Win32.WaitForSingleObject(handle, Win32.INFINITE);
if (rc != 0)
throw new SystemException(Status.describe(rc));
@@ -93,7 +92,7 @@ final class WindowsSemaphore extends Sem
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = Win32.WaitForSingleObject(handle, 0);
if (rc == 0)
return true;
@@ -106,7 +105,7 @@ final class WindowsSemaphore extends Sem
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = release0(handle);
if (rc != 0)
throw new SystemException(Status.describe(rc));
@@ -118,7 +117,7 @@ final class WindowsSemaphore extends Sem
boolean once = false;
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
while (true) {
int rc = Win32.WaitForSingleObject(handle, 0);
if (rc == 0) {
@@ -141,7 +140,7 @@ final class WindowsSemaphore extends Sem
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = Win32.CloseHandle(handle);
if (rc != 0)
throw new SystemException(Status.describe(rc));
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=1096674&r1=1096673&r2=1096674&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 Tue Apr 26 06:54:24 2011
@@ -125,7 +125,7 @@ final class WindowsShm extends Shm
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
synchronized (this) {
if (bptr != null) {
// TODO: Should we throw an exception here
@@ -144,7 +144,7 @@ final class WindowsShm extends Shm
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
synchronized (this) {
if (base != 0L) {
int rc = Win32.UnmapViewOfFile(base);
@@ -161,7 +161,7 @@ final class WindowsShm extends Shm
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = Win32.FlushViewOfFile(base, 0L);
if (rc != 0)
throw new SystemException(Status.describe(rc));
@@ -172,7 +172,7 @@ final class WindowsShm extends Shm
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
int rc = Win32.FlushViewOfFile(base, 0L);
if (rc != 0)
throw new SystemException(Status.describe(rc));
@@ -183,7 +183,7 @@ final class WindowsShm extends Shm
throws SystemException
{
if (handle == 0)
- throw new ClosedDescriptorException();
+ throw new InvalidHandleException();
detach();
handle = 0;
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/shmem.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/shmem.c?rev=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/shmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/shmem.c Tue Apr 26 06:54:24 2011
@@ -169,7 +169,7 @@ ACR_UNX_EXPORT(jlong, SysVShm, shmat0)(J
int flags = ro ? SHM_RDONLY : 0;
if ((sm = shmat(fd, sa, flags)) == (void *)-1) {
- ACR_THROW_SYS_ERROR();
+ ACR_THROW_BY_ERRNO();
sm = 0;
}
return P2J(sm);
@@ -230,7 +230,7 @@ ACR_UNX_EXPORT(jint, PosixShm, open0)(JN
WITH_CSTR(name) {
sd = shm_open(J2S(name), oflags, (mode_t)mode);
if (sd == -1) {
- ACR_THROW_SYS_ERROR();
+ ACR_THROW_BY_ERRNO();
}
} DONE_WITH_STR(name);
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=1096674&r1=1096673&r2=1096674&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Tue Apr 26 06:54:24 2011
@@ -746,7 +746,7 @@ AcrThrowByStatus(JNI_STDENV, int err, co
if (ACR_STATUS_IS_EEXIST(err))
cls = ACR_EX_EEXIST;
- else if (ACR_STATUS_IS_EEXIST(err))
+ else if (ACR_STATUS_IS_ENOENT(err))
cls = ACR_EX_ENOENT;
else if (ACR_STATUS_IS_EACCES(err))
cls = ACR_EX_EACCES;