commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1099826 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/net/ native/include/acr/ native/os/unix/ native/os/win32/ native/shared/
Date Thu, 05 May 2011 14:40:06 GMT
Author: mturk
Date: Thu May  5 14:40:05 2011
New Revision: 1099826

URL: http://svn.apache.org/viewvc?rev=1099826&view=rev
Log:
Add root network exceptio and modify throw macros

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/NetworkException.java
  (with props)
Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketAddress.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java
    commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h
    commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/shmem.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c
    commons/sandbox/runtime/trunk/src/main/native/shared/error.c
    commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketAddress.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketAddress.java?rev=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketAddress.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketAddress.java
Thu May  5 14:40:05 2011
@@ -24,6 +24,7 @@ import java.net.UnknownHostException;
 import org.apache.commons.runtime.Memory;
 import org.apache.commons.runtime.Status;
 import org.apache.commons.runtime.SystemException;
+import org.apache.commons.runtime.InvalidArgumentException;
 
 /**
  * This class represents a local socket endpoint described by a name.
@@ -42,25 +43,18 @@ public final class LocalSocketAddress ex
      * Create a new local socket adrress.
      */
     public LocalSocketAddress(String name)
-        throws SystemException, IllegalArgumentException
+        throws SystemException, InvalidArgumentException
     {
-        super(AddressFamily.LOCAL);
-        if (name == null)
-            throw new IllegalArgumentException("name can't be null");
-        sockaddr(name, AddressFamily.LOCAL);
+        super(name, AddressFamily.LOCAL);
     }
 
     /**
      * Create a new local socket adrress.
      */
     public LocalSocketAddress(File path)
-        throws SystemException, IllegalArgumentException
+        throws SystemException, InvalidArgumentException
     {
-        super(AddressFamily.LOCAL);
-        String host = path.getPath();
-        if (host == null)
-            throw new IllegalArgumentException("path can't be null");
-        sockaddr(host, AddressFamily.LOCAL);
+        super( path.getPath(), AddressFamily.LOCAL);
     }
 
 }

Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/NetworkException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/NetworkException.java?rev=1099826&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/NetworkException.java
(added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/NetworkException.java
Thu May  5 14:40:05 2011
@@ -0,0 +1,39 @@
+/* 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.net;
+
+import java.io.IOException;
+
+/**
+ * NetworkException is base exception class for all network errors
+ *
+ * @since Runtime 1.0
+ */
+
+public class NetworkException extends IOException
+{
+
+    public NetworkException()
+    {
+        super();
+    }
+
+    public NetworkException(String msg)
+    {
+        super(msg);
+    }
+}

Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/NetworkException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java?rev=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java
Thu May  5 14:40:05 2011
@@ -72,6 +72,38 @@ public abstract class SocketAddress exte
         super(family);
     }
 
+    protected SocketAddress(String host, AddressFamily family, int port, int flags)
+        throws InvalidArgumentException,
+               SystemException
+    {
+        super(family);
+        if (host == null && family == AddressFamily.LOCAL)
+            throw new InvalidArgumentException();
+        int rc = sockaddr0(host, family.valueOf(), port, flags);
+        if (rc != 0) {
+            if (rc == Errno.ENOMEM)
+                throw new OutOfMemoryError();
+            else
+                throw new SystemException(Status.describe(rc));
+        }
+    }
+
+    protected SocketAddress(String host, AddressFamily family)
+        throws InvalidArgumentException,
+               SystemException
+    {
+        super(family);
+        if (host == null && family == AddressFamily.LOCAL)
+            throw new InvalidArgumentException();
+        int rc = sockaddr0(host, family.valueOf(), 0, 0);
+        if (rc != 0) {
+            if (rc == Errno.ENOMEM)
+                throw new OutOfMemoryError();
+            else
+                throw new SystemException(Status.describe(rc));
+        }
+    }
+/*
     protected void sockaddr(String host, AddressFamily family, int port, int flags)
         throws SystemException
     {
@@ -95,7 +127,7 @@ public abstract class SocketAddress exte
                 throw new SystemException(Status.describe(rc));
         }
     }
-
+*/
     /**
      * Gets the hostname of this socket.
      *

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h?rev=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr/error.h Thu May  5 14:40:05
2011
@@ -43,7 +43,6 @@ enum {
     ACR_EX_ENOSYS,          /* java/lang/UnsupportedOperationException */
     ACR_EX_EIO,             /* java/io/IOException */
     ACR_EX_ESOCK,           /* java/net/SocketException */
-    ACR_EX_EHOST,           /* java/net/UnknownHostException */
 
     ACR_EX_EBADF,           /* io/InvalidDescriptorException */
     ACR_EX_EACCES,          /* AccessDeniedException */
@@ -56,6 +55,7 @@ enum {
     ACR_EX_EPERM,           /* OperationNotPermittedException */
     ACR_EX_TIMEOUT,         /* TimeoutException */
     ACR_EX_ESYS,            /* SystemException */
+    ACR_EX_ENET,            /* NetworkException */
     ACR_EX_LEN
 };
 
@@ -1603,18 +1603,19 @@ ACR_INLINE(DWORD) AcrNetOsError()
 
 #if defined(DEBUG) || defined(_DEBUG)
 #define ACR_THROW(CL, ER)       AcrDebugThrowException(env, __FILE_FUNC_LINE__, (CL), (ER))
-#define ACR_THROW_OS_ERROR(CL)  AcrDebugThrowException(env, __FILE_FUNC_LINE__, (CL), ACR_GET_OS_ERROR())
-#define ACR_THROW_SYS_ERROR()   AcrDebugThrowException(env, __FILE_FUNC_LINE__, ACR_EX_ESYS,
ACR_GET_OS_ERROR())
 #else
 #define ACR_THROW(CL, ER)       AcrThrowException(env, (CL), (ER))
-#define ACR_THROW_OS_ERROR(CL)  AcrThrowException(env, (CL), ACR_GET_OS_ERROR())
-#define ACR_THROW_SYS_ERROR()   AcrThrowException(env, ACR_EX_ESYS, ACR_GET_OS_ERROR())
 #endif
 #define ACR_THROW_MSG(CL, MS)   AcrThrow(env, (CL), MS)
-#define ACR_THROW_BY_ERRNO()    AcrThrowByStatus(env, ACR_GET_OS_ERROR(), 0)
-#define ACR_THROW_IO_ERRNO()    AcrThrowIoStatus(env, ACR_GET_OS_ERROR(), 0)
-#define ACR_THROW_BY_ERROR(ER)  AcrThrowByStatus(env, (ER), 0)
-#define ACR_THROW_IO_ERROR(ER)  AcrThrowIoStatus(env, (ER), 0)
+#define ACR_THROW_SYS_ERRNO()   AcrThrowByError(env,   ACR_EX_ESYS, ACR_GET_OS_ERROR(), 0)
+#define ACR_THROW_EIO_ERRNO()   AcrThrowByError(env,   ACR_EX_EIO,  ACR_GET_OS_ERROR(), 0)
+#define ACR_THROW_SYS_ERROR(ER) AcrThrowByError(env,   ACR_EX_ESYS, (ER), 0)
+#define ACR_THROW_EIO_ERROR(ER) AcrThrowByError(env,   ACR_EX_ESYS, (ER), 0)
+#define ACR_THROW_NET_ERRNO()   AcrThrowByError(env,   ACR_EX_ENET, ACR_GET_OS_ERROR(), 0)
+#define ACR_THROW_NET_ERROR(ER) AcrThrowByError(env,   ACR_EX_ENET, (ER), 0)
+#define ACR_THROW_NET(ER)       AcrThrowException(env, ACR_EX_ENET, (ER))
+#define ACR_THROW_SYS(ER)       AcrThrowException(env, ACR_EX_ESYS, (ER))
+#define ACR_THROW_EIO(ER)       AcrThrowException(env, ACR_EX_EIO,  (ER))
 
 #ifdef __cplusplus
 extern "C" {
@@ -1629,12 +1630,10 @@ AcrFatalError(JNI_STDENV,
 void
 AcrThrowByName(JNI_STDENV, const char *cls, const char *msg);
 void
-AcrThrowByStatus(JNI_STDENV, int err, const char *msg);
-void
-AcrThrowIoStatus(JNI_STDENV, int err, const char *msg);
-void
 AcrThrow(JNI_STDENV, int cls, const char *msg);
 void
+AcrThrowByError(JNI_STDENV, int def, int err, const char *msg);
+void
 AcrThrowClass(JNI_STDENV, const char *clazz, const char *msg);
 void
 AcrThrowException(JNI_STDENV, int clazz, int error);

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c?rev=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/procmutex.c Thu May  5 14:40:05
2011
@@ -139,12 +139,12 @@ ACR_UNX_EXPORT(jint, SysVMutex, create0)
 
         fd = open(J2S(name), O_WRONLY | O_CREAT | O_EXCL, 0660);
         if (fd == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         mkey = ftok(J2S(name), 'a');
         if (mkey == (key_t)-1) {
-            ACR_THROW_SYS_ERROR();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         /* Write our header to shadow file
@@ -156,12 +156,12 @@ ACR_UNX_EXPORT(jint, SysVMutex, create0)
         hdr.magic   = ACR_MTX_MAGIC;
         hdr.value   = 1;
         if (r_write(fd,(const void *)&hdr, nbytes) == -1) {
-            ACR_THROW_SYS_ERROR();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         pd = semget(mkey, 1, flags | 0660);
         if (pd == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
 cleanup:
@@ -170,7 +170,7 @@ cleanup:
             if (pd != -1) {
                 ick.val = 1;
                 if (semctl(pd, 0, SETVAL, ick) == -1) {
-                    ACR_THROW_SYS_ERROR();
+                    ACR_THROW_SYS_ERRNO();
                     ick.val = 0;
                     semctl(pd, 0, IPC_RMID, ick);
                     pd = -1;
@@ -194,7 +194,7 @@ ACR_UNX_EXPORT(jint, SysVMutex, open0)(J
 
         fd = open(J2S(name), O_RDONLY);
         if (fd == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         /* TODO: Read file header so we check if
@@ -202,13 +202,13 @@ ACR_UNX_EXPORT(jint, SysVMutex, open0)(J
          */
         mkey = ftok(J2S(name), 'a');
         if (mkey == (key_t)-1) {
-            ACR_THROW_SYS_ERROR();
+            ACR_THROW_SYS_ERRNO();
             close(fd);
             goto cleanup;
         }
         pd = semget(mkey, 1, 0);
         if (pd == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
 
@@ -297,7 +297,7 @@ ACR_UNX_EXPORT(jint, FcntlMutex, create0
     WITH_CSTR(name) {
         fd = open(J2S(name), O_WRONLY | O_CREAT | O_EXCL, 0660);
         if (fd == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
         }
     } DONE_WITH_STR(name);
 
@@ -311,7 +311,7 @@ ACR_UNX_EXPORT(jint, FcntlMutex, open0)(
     WITH_CSTR(name) {
         fd = open(J2S(name), O_RDONLY);
         if (fd == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
         }
     } DONE_WITH_STR(name);
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c?rev=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/semaphore.c Thu May  5 14:40:05
2011
@@ -92,7 +92,7 @@ ACR_UNX_EXPORT(jlong, PosixSemaphore, cr
     WITH_CSTR(name) {
         sp = sem_open(J2S(name), O_CREAT | O_EXCL, 0660, value);
         if (sp == SEM_FAILED) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
         }
     } DONE_WITH_STR(name);
 
@@ -107,7 +107,7 @@ ACR_UNX_EXPORT(jlong, PosixSemaphore, op
     WITH_CSTR(name) {
         sp = sem_open(J2S(name), O_RDWR, 0, 0);
         if (sp == SEM_FAILED) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
         }
     } DONE_WITH_STR(name);
 

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=1099826&r1=1099825&r2=1099826&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 Thu May  5 14:40:05 2011
@@ -80,12 +80,12 @@ ACR_UNX_EXPORT(jint, SysVShm, create0)(J
 
         fd = open(J2S(name), O_WRONLY | O_CREAT | O_EXCL, 0660);
         if (fd == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         skey = ftok(J2S(name), 'a');
         if (skey == (key_t)-1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         /* Write our header to shadow file
@@ -97,12 +97,12 @@ ACR_UNX_EXPORT(jint, SysVShm, create0)(J
         hdr.magic   = ACR_SHM_MAGIC;
         hdr.length  = realsize;
         if (r_write(fd, (const void *)&hdr, nbytes) == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         sd = shmget(skey, realsize, SHM_R | SHM_W | IPC_CREAT | IPC_EXCL);
         if (sd == -1)
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
 
 cleanup:
         if (fd != -1) {
@@ -127,7 +127,7 @@ ACR_UNX_EXPORT(jint, SysVShm, open0)(JNI
 
         fd = open(J2S(name), O_RDONLY);
         if (fd == -1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         nbytes = sizeof(shmblock_t);
@@ -150,12 +150,12 @@ ACR_UNX_EXPORT(jint, SysVShm, open0)(JNI
         }
         skey = ftok(J2S(name), 'a');
         if (skey == (key_t)-1) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
             goto cleanup;
         }
         sd = shmget(skey, 0, SHM_R | SHM_W);
         if (sd == -1)
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
 
 cleanup:
         if (fd != -1)
@@ -173,7 +173,7 @@ ACR_UNX_EXPORT(jlong, SysVShm, shmat0)(J
     int     flags = ro ? SHM_RDONLY : 0;
 
     if ((sm = shmat(fd, sa, flags)) == (void *)-1) {
-        ACR_THROW_BY_ERRNO();
+        ACR_THROW_SYS_ERRNO();
         sm = 0;
     }
     return P2J(sm);
@@ -234,7 +234,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_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
         }
     } DONE_WITH_STR(name);
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c?rev=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c Thu May  5 14:40:05
2011
@@ -68,7 +68,7 @@ ACR_WIN_EXPORT(jint, WindowsMutex, creat
     WITH_WSTR(name) {
         h = CreateMutexW(&sa, FALSE, J2S(name));
         if (h == 0) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
         }
     } DONE_WITH_STR(name);
 
@@ -82,7 +82,7 @@ ACR_WIN_EXPORT(jint, WindowsMutex, open0
     WITH_WSTR(name) {
         h =  OpenMutexW(MAXIMUM_ALLOWED, FALSE, J2S(name));
         if (h == 0) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
         }
     } DONE_WITH_STR(name);
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c?rev=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c Thu May  5 14:40:05
2011
@@ -71,7 +71,7 @@ ACR_WIN_EXPORT(jint, WindowsSemaphore, c
     WITH_WSTR(name) {
         h = CreateSemaphoreW(&sa, (LONG)value, (LONG)maxval, J2S(name));
         if (h == 0) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_ERRNO();
         }
     } DONE_WITH_STR(name);
 
@@ -85,7 +85,7 @@ ACR_WIN_EXPORT(jint, WindowsSemaphore, o
     WITH_WSTR(name) {
         h =  OpenSemaphoreW(READ_CONTROL | SEMAPHORE_MODIFY_STATE, FALSE, J2S(name));
         if (h == 0) {
-            ACR_THROW_BY_ERRNO();
+            ACR_THROW_SYS_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=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Thu May  5 14:40:05 2011
@@ -37,7 +37,6 @@ static struct {
     { 0, "java/lang/UnsupportedOperationException"              }, /* ENOSYS    */
     { 0, "java/io/IOException"                                  }, /* I/O Error */
     { 0, "java/net/SocketException"                             }, /* Net Error */
-    { 0, "java/net/UnknownHostException"                        }, /* Net Error */
 
     { 0, ACR_IO_CP      "InvalidDescriptorException"            }, /* EBADF     */
     { 0, ACR_CLASS_PATH "AccessDeniedException"                 }, /* EACCESS   */
@@ -49,7 +48,8 @@ static struct {
     { 0, ACR_CLASS_PATH "OperationNotImplementedException"      }, /* ENOTIMPL  */
     { 0, ACR_CLASS_PATH "OperationNotPermittedException"        }, /* EPERM     */
     { 0, ACR_CLASS_PATH "TimeoutException"                      }, /* ETIMEOUT  */
-    { 0, ACR_CLASS_PATH "SystemException"                       }
+    { 0, ACR_CLASS_PATH "SystemException"                       },
+    { 0, ACR_NET_CP     "NetworkException"                      }
 };
 
 static const char *const _canon_errors[] = {
@@ -743,8 +743,8 @@ AcrReleaseExceptionClasses(JNI_STDENV)
     }
 }
 
-static void
-_cr_throw_ex(JNI_STDENV, int def, int err, const char *msg)
+void
+AcrThrowByError(JNI_STDENV, int def, int err, const char *msg)
 {
     int cls = def;
 
@@ -775,18 +775,6 @@ _cr_throw_ex(JNI_STDENV, int def, int er
     AcrThrow(env, cls, msg);
 }
 
-void
-AcrThrowByStatus(JNI_STDENV, int err, const char *msg)
-{
-    _cr_throw_ex(env, ACR_EX_ESYS, err, msg);
-}
-
-void
-AcrThrowIoStatus(JNI_STDENV, int err, const char *msg)
-{
-    _cr_throw_ex(env, ACR_EX_EIO, err, msg);
-}
-
 ACR_JNI_EXPORT(jint, Status, init0)(JNI_STDARGS)
 {
     return ACR_OS_LAST_CANONERR - ACR_OS_START_CANONERR;

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c?rev=1099826&r1=1099825&r2=1099826&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c Thu May  5 14:40:05 2011
@@ -860,7 +860,7 @@ ACR_NET_EXPORT(jstring, SocketAddress, i
     if (AcrGetSockaddrIp(buf, 256, sa) == 0)
         return AcrNewJavaStringA(env, buf);
     else {
-        ACR_THROW_OS_ERROR(ACR_EX_EINVAL);
+        ACR_THROW_NET_ERROR(ACR_EINVAL);
         return 0;
     }
 }



Mime
View raw message