~svn/ubuntu/raring/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/bindings/java/javahl/native/JNIStringHolder.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:26:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205012614-qom4xfypgtsqc2xq
Tags: 1.2.3dfsg1-3ubuntu1
Merge with the final Debian release of 1.2.3dfsg1-3, bringing in
fixes to the clean target, better documentation of the libdb4.3
upgrade and build fixes to work with swig1.3_1.3.27.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @copyright
 
3
 * ====================================================================
 
4
 * Copyright (c) 2003 CollabNet.  All rights reserved.
 
5
 *
 
6
 * This software is licensed as described in the file COPYING, which
 
7
 * you should have received as part of this distribution.  The terms
 
8
 * are also available at http://subversion.tigris.org/license-1.html.
 
9
 * If newer versions of this license are posted there, you may use a
 
10
 * newer version instead, at your option.
 
11
 *
 
12
 * This software consists of voluntary contributions made by many
 
13
 * individuals.  For exact contribution history, see the revision
 
14
 * history and logs, available at http://subversion.tigris.org/.
 
15
 * ====================================================================
 
16
 * @endcopyright
 
17
 *
 
18
 * @file JNIStringHolder.cpp
 
19
 * @brief Implementation of the class JNIStringHolder
 
20
 */
 
21
#include <jni.h>
 
22
#include "JNIStringHolder.h"
 
23
#include "JNIUtil.h"
 
24
//////////////////////////////////////////////////////////////////////
 
25
// Construction/Destruction
 
26
//////////////////////////////////////////////////////////////////////
 
27
 
 
28
JNIStringHolder::JNIStringHolder(jstring jtext)
 
29
{
 
30
    if(jtext == NULL)
 
31
    {
 
32
        m_str = NULL;
 
33
        m_jtext = NULL;
 
34
        return;
 
35
    }
 
36
    m_str = JNIUtil::getEnv()->GetStringUTFChars(jtext, NULL);
 
37
    m_jtext = jtext;
 
38
    m_env = JNIUtil::getEnv();
 
39
}
 
40
 
 
41
JNIStringHolder::~JNIStringHolder()
 
42
{
 
43
    if(m_jtext && m_str)
 
44
        m_env->ReleaseStringUTFChars(m_jtext, m_str);
 
45
}