[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

JavaHL bug in native code?

From: Mark Phippard <markphip_at_gmail.com>
Date: Tue, 20 Dec 2011 13:28:35 -0500

We have had a few users report a weird error that looks like they are
getting an ArrayIndexOutOfBoundsException except that it appears that
it is coming out of the native code. This happens during an update
operation. I am going to paste some of the native code in here, in
case anyone sees anything in the array handling that looks wrong. The
use of ++i instead of i++ looks odd to me, but I am not a C++
programmer and the general code patterns.

    const apr_array_header_t *array = targets.array(subPool);
    SVN_JNI_ERR(targets.error_occured(), NULL);
    SVN_JNI_ERR(svn_client_update4(&revs, array,
                                   TRUE /* adds_as_modification */,
                                   ctx, subPool.getPool()),

    JNIEnv *env = JNIUtil::getEnv();
    jlongArray jrevs = env->NewLongArray(revs->nelts);
    if (JNIUtil::isJavaExceptionThrown())
        return NULL;
    jlong *jrevArray = env->GetLongArrayElements(jrevs, NULL);
    if (JNIUtil::isJavaExceptionThrown())
        return NULL;
    for (int i = 0; i < revs->nelts; ++i)
        jlong rev = APR_ARRAY_IDX(revs, i, svn_revnum_t);
        jrevArray[i] = rev;
    env->ReleaseLongArrayElements(jrevs, jrevArray, 0);

    return jrevs;

Mark Phippard
Received on 2011-12-20 19:29:09 CET

This is an archived mail posted to the Subversion Dev mailing list.