subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1456343 - in /subversion/trunk/subversion/bindings/javahl/native: CreateJ.cpp JNIUtil.cpp
Date Thu, 14 Mar 2013 06:26:22 GMT
Author: brane
Date: Thu Mar 14 06:26:22 2013
New Revision: 1456343

URL: http://svn.apache.org/r1456343
Log:
[in subversion/bindings/javahl/native]
* CreateJ.cpp (CreateJ::ClientNotifyInformation): Update exception message.
* JNIUtil.cpp (JNIUtil::handleSVNError):
   Check for overflow when converting a C size_t to a JNI jsize.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=1456343&r1=1456342&r2=1456343&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Thu Mar 14 06:26:22 2013
@@ -734,7 +734,7 @@ CreateJ::ClientNotifyInformation(const s
   if (jhunkFuzz != wcNotify->hunk_fuzz)
     {
       env->ThrowNew(env->FindClass("java.lang.ArithmeticException"),
-                    "Overflow converting C unsigned long to Java int");
+                    "Overflow converting C svn_linenum_t to Java int");
       POP_AND_RETURN_NULL;
     }
 

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1456343&r1=1456342&r2=1456343&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp Thu Mar 14 06:26:22 2013
@@ -512,8 +512,14 @@ void JNIUtil::handleSVNError(svn_error_t
   if (isJavaExceptionThrown())
     POP_AND_RETURN_NOTHING();
 
-  jobjectArray jStackTrace = env->NewObjectArray(newStackTrace.size(), stClazz,
-                                                 NULL);
+  const jsize stSize = static_cast<jsize>(newStackTrace.size());
+  if (stSize != newStackTrace.size())
+    {
+      env->ThrowNew(env->FindClass("java.lang.ArithmeticException"),
+                    "Overflow converting C size_t to JNI jsize");
+      POP_AND_RETURN_NOTHING();
+    }
+  jobjectArray jStackTrace = env->NewObjectArray(stSize, stClazz, NULL);
   if (isJavaExceptionThrown())
     POP_AND_RETURN_NOTHING();
 



Mime
View raw message