You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2006/07/18 16:49:48 UTC
svn commit: r423094 - in /incubator/harmony/enhanced/classlib/trunk/modules:
archive/src/main/native/archive/shared/ luni/
luni/src/main/native/common/linux/ luni/src/main/native/common/shared/
luni/src/main/native/include/shared/ luni/src/main/native/...
Author: hindessm
Date: Tue Jul 18 07:49:46 2006
New Revision: 423094
URL: http://svn.apache.org/viewvc?rev=423094&view=rev
Log:
Move exception functions to separate source file.
Added:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/exceptions.c (with props)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/exceptions.h (with props)
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/linux/makefile
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/iohelp.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/iohelp.h
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/file.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/proxy.c
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/deflater.c Tue Jul 18 07:49:46 2006
@@ -15,6 +15,7 @@
#include "vmi.h"
#include "iohelp.h"
+#include "exceptions.h"
#include "zlib.h"
#include "inflater.h"
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/inflater.c Tue Jul 18 07:49:46 2006
@@ -15,6 +15,7 @@
#include "vmi.h"
#include "iohelp.h"
+#include "exceptions.h"
#include "jclglob.h"
#include "jclprots.h"
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/jarfile.c Tue Jul 18 07:49:46 2006
@@ -15,6 +15,7 @@
#include "vmi.h"
#include "iohelp.h"
+#include "exceptions.h"
#include "jclglob.h"
#include "jclprots.h"
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/native/archive/shared/zip.c Tue Jul 18 07:49:46 2006
@@ -14,6 +14,7 @@
*/
#include "iohelp.h"
+#include "exceptions.h"
#include "jclglob.h"
#include "jclprots.h"
#include "zip.h"
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/build.xml Tue Jul 18 07:49:46 2006
@@ -53,6 +53,7 @@
<include name="hyporterror.h" />
<include name="gp.h" />
<include name="iohelp.h" />
+ <include name="exceptions.h" />
<include name="libglob.h" />
<include name="fdlibm.h" />
<include name="hymagic.h" />
@@ -233,6 +234,7 @@
<include name="hysock.h" />
<include name="hyportpg.h" />
<include name="iohelp.h" />
+ <include name="exceptions.h" />
<include name="libglob.h" />
<include name="fdlibm.h" />
<include name="hymagic.h" />
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/linux/makefile
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/linux/makefile?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/linux/makefile (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/linux/makefile Tue Jul 18 07:49:46 2006
@@ -19,6 +19,7 @@
include $(HY_HDK)/build/make/makefile.include
BUILDFILES = $(SHAREDSUB)libglob.o $(SHAREDSUB)iohelp.o \
+ $(SHAREDSUB)exceptions.o \
$(SHAREDSUB)utf8encode.o $(SHAREDSUB)utf8decode.o
LIBNAME = $(LIBPATH)libhycommon.a
Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/exceptions.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/exceptions.c?rev=423094&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/exceptions.c (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/exceptions.c Tue Jul 18 07:49:46 2006
@@ -0,0 +1,85 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed 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.
+ */
+
+#include "exceptions.h"
+#include "jclglob.h"
+
+/**
+ * Throw java.io.IOException with the message provided
+ */
+void throwJavaIoIOException(JNIEnv *env, char *message)
+{
+ jclass exceptionClass = (*env)->FindClass(env, "java/io/IOException");
+ if (0 == exceptionClass) {
+ /* Just return if we can't load the exception class. */
+ return;
+ }
+ (*env)->ThrowNew(env, exceptionClass, message);
+}
+
+/**
+ * Throw java.io.IOException with the "File closed" message
+ * Consolidate all through here so message is consistent.
+ */
+void
+throwJavaIoIOExceptionClosed (JNIEnv * env)
+{
+ throwJavaIoIOException (env, "File closed");
+}
+
+/**
+ * Throw java.lang.IndexOutOfBoundsException
+ */
+void
+throwIndexOutOfBoundsException (JNIEnv * env)
+{
+ jclass exceptionClass = (*env)->FindClass(env, "java/lang/IndexOutOfBoundsException");
+ if (0 == exceptionClass) {
+ /* Just return if we can't load the exception class. */
+ return;
+ }
+ (*env)->ThrowNew(env, exceptionClass, "");
+}
+
+/**
+ * Throw java.lang.NullPointerException with the message provided
+ * Note: This is not named throwNullPointerException because it conflicts
+ * with a VM function of that same name and this causes problems on
+ * some platforms.
+ */
+void
+throwNPException (JNIEnv * env, char *message)
+{
+ jclass exceptionClass = (*env)->FindClass(env, "java/lang/NullPointerException");
+ if (0 == exceptionClass) {
+ /* Just return if we can't load the exception class. */
+ return;
+ }
+ (*env)->ThrowNew(env, exceptionClass, message);
+}
+
+/**
+ * Throw java.lang.OutOfMemoryError
+ */
+void
+throwNewOutOfMemoryError (JNIEnv * env, char *message)
+{
+ jclass exceptionClass = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
+ if (0 == exceptionClass) {
+ /* Just return if we can't load the exception class. */
+ return;
+ }
+ (*env)->ThrowNew(env, exceptionClass, message);
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/exceptions.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/iohelp.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/iohelp.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/iohelp.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/common/shared/iohelp.c Tue Jul 18 07:49:46 2006
@@ -14,25 +14,12 @@
*/
#include "iohelp.h"
+#include "exceptions.h"
#include "jclglob.h"
jfieldID getJavaIoFileDescriptorDescriptorFID (JNIEnv * env);
/**
- * Throw java.io.IOException with the message provided
- */
-void
-throwJavaIoIOException (JNIEnv * env, char *message)
-{
- jclass exceptionClass = (*env)->FindClass(env, "java/io/IOException");
- if (0 == exceptionClass) {
- /* Just return if we can't load the exception class. */
- return;
- }
- (*env)->ThrowNew(env, exceptionClass, message);
-}
-
-/**
* This will convert all separators to the proper platform separator
* and remove duplicates on non POSIX platforms.
*/
@@ -85,30 +72,6 @@
}
/**
- * Throw java.io.IOException with the "File closed" message
- * Consolidate all through here so message is consistent.
- */
-void
-throwJavaIoIOExceptionClosed (JNIEnv * env)
-{
- throwJavaIoIOException (env, "File closed");
-}
-
-/**
- * Throw java.lang.IndexOutOfBoundsException
- */
-void
-throwIndexOutOfBoundsException (JNIEnv * env)
-{
- jclass exceptionClass = (*env)->FindClass(env, "java/lang/IndexOutOfBoundsException");
- if (0 == exceptionClass) {
- /* Just return if we can't load the exception class. */
- return;
- }
- (*env)->ThrowNew(env, exceptionClass, "");
-}
-
-/**
* This will write count bytes from buffer starting at offset
*/
void
@@ -326,23 +289,6 @@
}
/**
- * Throw java.lang.NullPointerException with the message provided
- * Note: This is not named throwNullPointerException because it conflicts
- * with a VM function of that same name and this causes problems on
- * some platforms.
- */
-void
-throwNPException (JNIEnv * env, char *message)
-{
- jclass exceptionClass = (*env)->FindClass(env, "java/lang/NullPointerException");
- if (0 == exceptionClass) {
- /* Just return if we can't load the exception class. */
- return;
- }
- (*env)->ThrowNew(env, exceptionClass, message);
-}
-
-/**
* This will return the number of chars left in the file
*/
jint
@@ -437,20 +383,6 @@
{
(*env)->SetLongField (env, fd, fid, (IDATA)value);
}
-}
-
-/**
- * Throw java.lang.OutOfMemoryError
- */
-void
-throwNewOutOfMemoryError (JNIEnv * env, char *message)
-{
- jclass exceptionClass = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
- if (0 == exceptionClass) {
- /* Just return if we can't load the exception class. */
- return;
- }
- (*env)->ThrowNew(env, exceptionClass, message);
}
/**
Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/exceptions.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/exceptions.h?rev=423094&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/exceptions.h (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/exceptions.h Tue Jul 18 07:49:46 2006
@@ -0,0 +1,27 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed 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.
+ */
+
+#ifndef EXCEPTIONS_H
+#define EXCEPTIONS_H
+
+#include <string.h>
+#include "vmi.h"
+void throwNewOutOfMemoryError(JNIEnv *env, char *message);
+void throwJavaIoIOException(JNIEnv *env, char *message);
+void throwJavaIoIOExceptionClosed(JNIEnv *env);
+void throwNPException(JNIEnv *env, char *message);
+void throwIndexOutOfBoundsException(JNIEnv *env);
+
+#endif
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/exceptions.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/iohelp.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/iohelp.h?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/iohelp.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/iohelp.h Tue Jul 18 07:49:46 2006
@@ -17,16 +17,14 @@
#define iohelp_h
#include <string.h>
#include "vmi.h"
+#include "exceptions.h"
+
/* DIR_SEPARATOR is defined in hycomp.h */
#define jclSeparator DIR_SEPARATOR
void *getJavaIoFileDescriptorContentsAsPointer (JNIEnv * env, jobject fd);
-void throwNewOutOfMemoryError (JNIEnv * env, char *message);
jint ioh_readcharImpl (JNIEnv * env, jobject recv, IDATA descriptor);
-void throwJavaIoIOException (JNIEnv * env, char *message);
-void throwJavaIoIOExceptionClosed (JNIEnv * env);
void ioh_convertToPlatform (char *path);
jint new_ioh_available (JNIEnv * env, jobject recv, jfieldID fdFID);
-void throwNPException (JNIEnv * env, char *message);
void setJavaIoFileDescriptorContentsAsPointer (JNIEnv * env, jobject fd,
void *value);
void ioh_writebytesImpl (JNIEnv * env, jobject recv, jbyteArray buffer,
@@ -36,5 +34,5 @@
jint ioh_readbytesImpl (JNIEnv * env, jobject recv, jbyteArray buffer,
jint offset, jint count, IDATA descriptor);
void new_ioh_close (JNIEnv * env, jobject recv, jfieldID fdFID);
-void throwIndexOutOfBoundsException (JNIEnv * env);
+
#endif /* iohelp_h */
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSFileSystem.c Tue Jul 18 07:49:46 2006
@@ -19,6 +19,7 @@
#include "vmi.h"
#include <string.h>
#include "iohelp.h"
+#include "exceptions.h"
#include "OSFileSystem.h"
#include "IFileSystem.h"
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/file.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/file.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/file.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/file.c Tue Jul 18 07:49:46 2006
@@ -16,6 +16,7 @@
#include <string.h>
#include <ctype.h>
#include "iohelp.h"
+#include "exceptions.h"
#include "jclglob.h"
#include "helpers.h"
#include "jclprots.h"
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/filedesc.c Tue Jul 18 07:49:46 2006
@@ -14,6 +14,7 @@
*/
#include "iohelp.h"
+#include "exceptions.h"
#include "jclglob.h"
jboolean JNICALL
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h Tue Jul 18 07:49:46 2006
@@ -16,6 +16,7 @@
#if !defined(nethelp_h)
#define nethelp_h
#include "iohelp.h"
+#include "exceptions.h"
#include "hysocket.h"
#define JAVASOCKOPT_TCP_NODELAY 1
#define JAVASOCKOPT_SO_REUSEADDR 4
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c Tue Jul 18 07:49:46 2006
@@ -14,6 +14,7 @@
*/
#include "iohelp.h"
+#include "exceptions.h"
#include "procimpl.h"
#include "jclglob.h"
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/proxy.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/proxy.c?rev=423094&r1=423093&r2=423094&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/proxy.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/proxy.c Tue Jul 18 07:49:46 2006
@@ -14,6 +14,7 @@
*/
#include "iohelp.h"
+#include "exceptions.h"
#include "jclglob.h"
jclass JNICALL