rjb 1.0.3-mswin32 → 1.0.4-mswin32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
1
- /* DO NOT EDIT THIS FILE - it is machine generated */
1
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2
2
  #include <jni.h>
3
- /* Header for class jp_co_infoseek_hp_arton_rjb_RBridge */
4
-
5
- #ifndef _Included_jp_co_infoseek_hp_arton_rjb_RBridge
3
+ /* Header for class jp_co_infoseek_hp_arton_rjb_RBridge */
4
+
5
+ #ifndef _Included_jp_co_infoseek_hp_arton_rjb_RBridge
6
6
  #define _Included_jp_co_infoseek_hp_arton_rjb_RBridge
7
- #ifdef __cplusplus
8
- extern "C" {
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
9
  #endif
10
10
  /*
11
11
  * Class: jp_co_infoseek_hp_arton_rjb_RBridge
@@ -13,9 +13,9 @@ extern "C" {
13
13
  * Signature: (Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
14
14
  */
15
15
  JNIEXPORT jobject JNICALL Java_jp_co_infoseek_hp_arton_rjb_RBridge_call
16
- (JNIEnv *, jobject, jstring, jobject, jobjectArray);
16
+ (JNIEnv *, jobject, jstring, jobject, jobjectArray);
17
17
 
18
- #ifdef __cplusplus
19
- }
18
+ #ifdef __cplusplus
19
+ }
20
20
  #endif
21
21
  #endif
data/ext/load.c CHANGED
@@ -12,7 +12,7 @@
12
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
13
  * Lesser General Public License for more details.
14
14
  *
15
- * $Id: load.c 8 2006-11-20 19:17:22Z arton $
15
+ * $Id: load.c 9 2006-11-20 19:26:14Z arton $
16
16
  */
17
17
 
18
18
  #include <stdlib.h>
data/ext/rjb.c CHANGED
@@ -12,10 +12,10 @@
12
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
13
  * Lesser General Public License for more details.
14
14
  *
15
- * $Id: rjb.c 8 2006-11-20 19:17:22Z arton $
15
+ * $Id: rjb.c 11 2007-05-06 10:02:52Z arton $
16
16
  */
17
17
 
18
- #define RJB_VERSION "1.0.3"
18
+ #define RJB_VERSION "1.0.4"
19
19
 
20
20
  #include "ruby.h"
21
21
  #include "st.h"
@@ -1885,6 +1885,7 @@ static VALUE rjb_newinstance_s(int argc, VALUE* argv, VALUE self)
1885
1885
  VALUE ret = Qnil;
1886
1886
  struct jv_data* ptr;
1887
1887
  JNIEnv* jenv = rjb_attach_current_thread();
1888
+ int found = 0;
1888
1889
 
1889
1890
  rb_scan_args(argc, argv, "1*", &vsig, &rest);
1890
1891
  sig = StringValueCStr(vsig);
@@ -1897,11 +1898,15 @@ static VALUE rjb_newinstance_s(int argc, VALUE* argv, VALUE self)
1897
1898
  if ((*pc)->arg_count == argc - 1
1898
1899
  && !strcmp(sig, (*pc)->method_signature))
1899
1900
  {
1901
+ found = 1;
1900
1902
  ret = createinstance(jenv, argc - 1, argv + 1, &ptr->idata, *pc);
1901
1903
  break;
1902
1904
  }
1903
1905
  }
1904
1906
  }
1907
+ if (!found) {
1908
+ rb_raise(rb_eRuntimeError, "Constructor not found");
1909
+ }
1905
1910
  return ret;
1906
1911
  }
1907
1912
 
@@ -1911,12 +1916,13 @@ static VALUE rjb_newinstance(int argc, VALUE* argv, VALUE self)
1911
1916
  struct jv_data* ptr;
1912
1917
  struct cls_constructor** pc;
1913
1918
  JNIEnv* jenv = rjb_attach_current_thread();
1919
+ int found = 0;
1914
1920
 
1915
1921
  Data_Get_Struct(self, struct jv_data, ptr);
1916
1922
 
1917
1923
  if (ptr->constructors)
1918
1924
  {
1919
- int i, found = 0;
1925
+ int i;
1920
1926
  char* psig;
1921
1927
  for (pc = ptr->constructors; *pc; pc++)
1922
1928
  {
@@ -1941,6 +1947,9 @@ static VALUE rjb_newinstance(int argc, VALUE* argv, VALUE self)
1941
1947
  }
1942
1948
  }
1943
1949
  }
1950
+ if (!found) {
1951
+ rb_raise(rb_eRuntimeError, "Constructor not found");
1952
+ }
1944
1953
  return ret;
1945
1954
  }
1946
1955
 
Binary file
@@ -1,5 +1,5 @@
1
1
  #!/usr/local/env ruby
2
- # $Id: test.rb 4 2006-09-11 15:21:38Z arton $
2
+ # $Id: test.rb 11 2007-05-06 10:02:52Z arton $
3
3
 
4
4
  require 'test/unit'
5
5
  require 'rjb'
@@ -411,5 +411,15 @@ class TestRjb < Test::Unit::TestCase
411
411
  assert_equal(nil, test.callWithArraies(nil, nil, nil, nil, nil, nil,
412
412
  nil, nil))
413
413
  end
414
+
415
+ def test_failed_constructor_call()
416
+ test = import('java.lang.String')
417
+ begin
418
+ s = test.new('a', 'b', 'c')
419
+ flunk('no exception')
420
+ rescue RuntimeError => e
421
+ assert(e)
422
+ end
423
+ end
414
424
  end
415
425
 
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: rjb
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.3
7
- date: 2006-11-21 00:00:00 +09:00
6
+ version: 1.0.4
7
+ date: 2007-05-06 00:00:00 +09:00
8
8
  summary: Ruby Java bridge
9
9
  require_paths:
10
10
  - lib
@@ -32,22 +32,22 @@ files:
32
32
  - ext/RBridge.java
33
33
  - ext/load.c
34
34
  - ext/riconv.c
35
- - ext/rjb.c
36
35
  - ext/rjbexception.c
36
+ - ext/rjb.c
37
37
  - ext/jniwrap.h
38
- - ext/jp_co_infoseek_hp_arton_rjb_RBridge.h
39
- - ext/riconv.h
40
38
  - ext/rjb.h
39
+ - ext/riconv.h
40
+ - ext/jp_co_infoseek_hp_arton_rjb_RBridge.h
41
41
  - ext/depend
42
42
  - data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
43
43
  - lib/rjb.rb
44
44
  - samples/filechooser.rb
45
45
  - test/gctest.rb
46
46
  - test/test.rb
47
- - test/jp/co/infoseek/hp/arton/rjb/Base.class
48
47
  - test/jp/co/infoseek/hp/arton/rjb/ExtBase.class
49
- - test/jp/co/infoseek/hp/arton/rjb/IBase.class
50
48
  - test/jp/co/infoseek/hp/arton/rjb/Test.class
49
+ - test/jp/co/infoseek/hp/arton/rjb/IBase.class
50
+ - test/jp/co/infoseek/hp/arton/rjb/Base.class
51
51
  - COPYING
52
52
  - ChangeLog
53
53
  - readme.sj