commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [35/50] commons-crypto git commit: CRYPTO-114 exception.c/exception.h are not used
Date Fri, 22 Jul 2016 07:01:03 GMT
CRYPTO-114 exception.c/exception.h are not used

Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/4ac4fedf
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/4ac4fedf
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/4ac4fedf

Branch: refs/heads/CRYPTO-1.0.0
Commit: 4ac4fedf1bbe662e8c485eee653f9dbe34f2b853
Parents: 79502d4
Author: Sebb <sebb@apache.org>
Authored: Sun Jul 10 12:50:21 2016 +0100
Committer: Sebb <sebb@apache.org>
Committed: Sun Jul 10 12:50:21 2016 +0100

----------------------------------------------------------------------
 .../org/apache/commons/crypto/exception.c       | 124 -------------------
 .../org/apache/commons/crypto/exception.h       | 104 ----------------
 2 files changed, 228 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4ac4fedf/src/main/native/org/apache/commons/crypto/exception.c
----------------------------------------------------------------------
diff --git a/src/main/native/org/apache/commons/crypto/exception.c b/src/main/native/org/apache/commons/crypto/exception.c
deleted file mode 100644
index fc072e8..0000000
--- a/src/main/native/org/apache/commons/crypto/exception.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * 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.
- */
-
-#include "exception.h"
-
-#include <jni.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-jthrowable newExceptionV(JNIEnv* env, const char *name,
-                         const char *fmt, va_list ap)
-{
-  int need;
-  char buf[1], *msg = NULL;
-  va_list ap2;
-  jstring jstr = NULL;
-  jthrowable jthr;
-  jclass clazz;
-  jmethodID excCtor;
-
-  va_copy(ap2, ap);
-  clazz = (*env)->FindClass(env, name);
-  if (!clazz) {
-    jthr = (*env)->ExceptionOccurred(env);
-    (*env)->ExceptionClear(env);
-    goto done;
-  }
-  excCtor = (*env)->GetMethodID(env,
-        clazz, "<init>", "(Ljava/lang/String;)V");
-  if (!excCtor) {
-    jthr = (*env)->ExceptionOccurred(env);
-    (*env)->ExceptionClear(env);
-    goto done;
-  }
-  need = vsnprintf(buf, sizeof(buf), fmt, ap);
-  if (need < 0) {
-    fmt = "vsnprintf error";
-    need = strlen(fmt);
-  }
-  msg = malloc(need + 1);
-  vsnprintf(msg, need + 1, fmt, ap2);
-  jstr = (*env)->NewStringUTF(env, msg);
-  if (!jstr) {
-    jthr = (*env)->ExceptionOccurred(env);
-    (*env)->ExceptionClear(env);
-    goto done;
-  }
-  jthr = (*env)->NewObject(env, clazz, excCtor, jstr);
-  if (!jthr) {
-    jthr = (*env)->ExceptionOccurred(env);
-    (*env)->ExceptionClear(env);
-    goto done;
-  }
-
-done:
-  free(msg);
-  va_end(ap2);
-  (*env)->DeleteLocalRef(env, jstr);
-  return jthr;
-}
-
-jthrowable newException(JNIEnv* env, const char *name, const char *fmt, ...)
-{
-  va_list ap;
-  jthrowable jthr;
-
-  va_start(ap, fmt);
-  jthr = newExceptionV(env, name, fmt, ap);
-  va_end(ap);
-  return jthr;
-}
-
-jthrowable newRuntimeException(JNIEnv* env, const char *fmt, ...)
-{
-  va_list ap;
-  jthrowable jthr;
-
-  va_start(ap, fmt);
-  jthr = newExceptionV(env, "java/lang/RuntimeException", fmt, ap);
-  va_end(ap);
-  return jthr;
-}
-
-jthrowable newIOException(JNIEnv* env, const char *fmt, ...)
-{
-  va_list ap;
-  jthrowable jthr;
-
-  va_start(ap, fmt);
-  jthr = newExceptionV(env, "java/io/IOException", fmt, ap);
-  va_end(ap);
-  return jthr;
-}
-
-const char* terror(int errnum)
-{
-
-#if defined(__sun)
-// MT-Safe under Solaris which doesn't support sys_errlist/sys_nerr
-  return strerror(errnum); 
-#else
-  if ((errnum < 0) || (errnum >= sys_nerr)) {
-    return "unknown error.";
-  }
-  return sys_errlist[errnum];
-#endif
-}
-

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4ac4fedf/src/main/native/org/apache/commons/crypto/exception.h
----------------------------------------------------------------------
diff --git a/src/main/native/org/apache/commons/crypto/exception.h b/src/main/native/org/apache/commons/crypto/exception.h
deleted file mode 100644
index d67d553..0000000
--- a/src/main/native/org/apache/commons/crypto/exception.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *  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.
- */
-#ifndef COMMONS_CRYPTO_NATIVE_SRC_EXCEPTION_H
-#define COMMONS_CRYPTO_NATIVE_SRC_EXCEPTION_H
-
-#include <jni.h> /* for jthrowable */
-#include <stdarg.h> /* for va_list */
-#include "org_apache_commons_crypto.h"
-
-#ifdef WINDOWS
-/*
- * gcc-style type-checked format arguments are not supported on Windows, so just
- * stub this macro.
- */
-#define TYPE_CHECKED_PRINTF_FORMAT(formatArg, varArgs)
-# else
-/* Use gcc type-checked format arguments. */
-#define TYPE_CHECKED_PRINTF_FORMAT(formatArg, varArgs) \
-  __attribute__((format(printf, formatArg, varArgs)))
-#endif
-
-/**
- * Create a new Exception.
- *
- * No exceptions will be pending on return.
- *
- * @param env           The JNI environment
- * @param name          full name of the Java exception class
- * @param fmt           printf-style format string
- * @param ap            printf-style arguments
- *
- * @return              The RuntimeException
- */
-jthrowable newExceptionV(JNIEnv* env, const char *name,
-                         const char *fmt, va_list ap);
-
-/**
- * Create a new Exception.
- *
- * No exceptions will be pending on return.
- *
- * @param env           The JNI environment
- * @param name          full name of the Java exception class
- * @param fmt           printf-style format string
- * @param ...           printf-style arguments
- *
- * @return              The RuntimeException
- */
-jthrowable newException(JNIEnv* env, const char *name, const char *fmt, ...)
-    TYPE_CHECKED_PRINTF_FORMAT(3, 4);
-
-/**
- * Create a new RuntimeException.
- *
- * No exceptions will be pending on return.
- *
- * @param env           The JNI environment
- * @param fmt           printf-style format string
- * @param ...           printf-style arguments
- *
- * @return              The RuntimeException
- */
-jthrowable newRuntimeException(JNIEnv* env, const char *fmt, ...)
-    TYPE_CHECKED_PRINTF_FORMAT(2, 3);
-
-/**
- * Create a new IOException.
- *
- * No exceptions will be pending on return.
- *
- * @param env           The JNI environment
- * @param fmt           printf-style format string
- * @param ...           printf-style arguments
- *
- * @return              The IOException, or another exception if we failed
- *                      to create the NativeIOException.
- */
-jthrowable newIOException(JNIEnv* env, const char *fmt, ...)
-    TYPE_CHECKED_PRINTF_FORMAT(2, 3);
-
-/**
- * Thread-safe strerror alternative.
- *
- * @param errnum        Error number.
- * @return              Statically allocated error string.
- */
-const char* terror(int errnum);
-
-#undef TYPE_CHECKED_PRINTF_FORMAT
-#endif


Mime
View raw message