~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/bindings/javahl/native/jniwrapper/jni_list.cpp

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @copyright
 
3
 * ====================================================================
 
4
 *    Licensed to the Apache Software Foundation (ASF) under one
 
5
 *    or more contributor license agreements.  See the NOTICE file
 
6
 *    distributed with this work for additional information
 
7
 *    regarding copyright ownership.  The ASF licenses this file
 
8
 *    to you under the Apache License, Version 2.0 (the
 
9
 *    "License"); you may not use this file except in compliance
 
10
 *    with the License.  You may obtain a copy of the License at
 
11
 *
 
12
 *      http://www.apache.org/licenses/LICENSE-2.0
 
13
 *
 
14
 *    Unless required by applicable law or agreed to in writing,
 
15
 *    software distributed under the License is distributed on an
 
16
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
17
 *    KIND, either express or implied.  See the License for the
 
18
 *    specific language governing permissions and limitations
 
19
 *    under the License.
 
20
 * ====================================================================
 
21
 * @endcopyright
 
22
 */
 
23
 
 
24
#include <stdexcept>
 
25
#include <string>
 
26
 
 
27
#include "jni_list.hpp"
 
28
 
 
29
#include "svn_private_config.h"
 
30
 
 
31
namespace Java {
 
32
 
 
33
// Class Java::BaseImmutableList
 
34
 
 
35
const char* const BaseImmutableList::m_class_name = "java/util/List";
 
36
 
 
37
BaseImmutableList::ClassImpl::ClassImpl(Env env, jclass cls)
 
38
  : Object::ClassImpl(env, cls),
 
39
    m_mid_size(env.GetMethodID(cls, "size", "()I")),
 
40
    m_mid_get(env.GetMethodID(cls, "get", "(I)Ljava/lang/Object;")),
 
41
    m_mid_add(env.GetMethodID(cls, "add", "(Ljava/lang/Object;)Z")),
 
42
    m_mid_clear(env.GetMethodID(cls, "clear", "()V")),
 
43
    m_mid_iter(env.GetMethodID(cls, "listIterator", "()Ljava/util/ListIterator;"))
 
44
{}
 
45
 
 
46
BaseImmutableList::ClassImpl::~ClassImpl() {}
 
47
 
 
48
jobject BaseImmutableList::operator[](jint index) const
 
49
{
 
50
  try
 
51
    {
 
52
      return m_env.CallObjectMethod(m_jthis, impl().m_mid_get, index);
 
53
    }
 
54
  catch (const SignalExceptionThrown&)
 
55
    {
 
56
      // Just rethrow if it's not an IndexOutOfBoundsException.
 
57
      if (!m_env.IsInstanceOf(
 
58
              m_env.ExceptionOccurred(),
 
59
              ClassCache::get_exc_index_out_of_bounds(m_env)->get_class()))
 
60
        throw;
 
61
 
 
62
      m_env.ExceptionClear();
 
63
      std::string msg(_("List index out of bounds: "));
 
64
      msg += index;
 
65
      throw std::out_of_range(msg.c_str());
 
66
    }
 
67
}
 
68
 
 
69
BaseImmutableList::Iterator BaseImmutableList::get_iterator() const
 
70
{
 
71
  return Iterator(m_env, m_env.CallObjectMethod(m_jthis, impl().m_mid_iter));
 
72
}
 
73
 
 
74
// Class Java::BaseList
 
75
 
 
76
const char* const BaseList::m_class_name = "java/util/ArrayList";
 
77
 
 
78
BaseList::ClassImpl::ClassImpl(Env env, jclass cls)
 
79
  : BaseImmutableList::ClassImpl(env, cls),
 
80
    m_mid_ctor(env.GetMethodID(cls, "<init>", "(I)V"))
 
81
{}
 
82
 
 
83
BaseList::ClassImpl::~ClassImpl() {}
 
84
 
 
85
} // namespace Java