rjb 1.4.7-x86-mswin32-100 → 1.4.9-x86-mswin32-100

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,5 +3,5 @@
3
3
  #define HAVE_JNI_H 1
4
4
  #define HAVE_SETLOCALE 1
5
5
  #define HAVE_GETENV 1
6
- #define RJB_RUBY_VERSION_CODE 193
6
+ #define RJB_RUBY_VERSION_CODE 210
7
7
  #endif
data/ext/rjb.c CHANGED
@@ -15,7 +15,7 @@
15
15
  * $Id: rjb.c 199 2012-12-17 13:31:18Z arton $
16
16
  */
17
17
 
18
- #define RJB_VERSION "1.4.7"
18
+ #define RJB_VERSION "1.4.9"
19
19
 
20
20
  #include "ruby.h"
21
21
  #include "extconf.h"
@@ -1066,7 +1066,14 @@ static jarray r2objarray(JNIEnv* jenv, VALUE v, const char* cls)
1066
1066
  if (TYPE(v) == T_ARRAY)
1067
1067
  {
1068
1068
  int i;
1069
- ary = (*jenv)->NewObjectArray(jenv, (jint)RARRAY_LEN(v), j_object, NULL);
1069
+ jclass jcls = NULL;
1070
+ char* p = strchr(cls, ';');
1071
+ if (p)
1072
+ {
1073
+ volatile VALUE clsname = rb_str_new(cls + 1, p - cls - 1); // skip first 'L'
1074
+ jcls = rjb_find_class(jenv, clsname);
1075
+ }
1076
+ ary = (*jenv)->NewObjectArray(jenv, (jint)RARRAY_LEN(v), (jcls) ? jcls : j_object, NULL);
1070
1077
  rjb_check_exception(jenv, 0);
1071
1078
  for (i = 0; i < RARRAY_LEN(v); i++)
1072
1079
  {
@@ -32,6 +32,11 @@ static VALUE missing_delegate(int argc, VALUE* argv, VALUE self)
32
32
  return rb_funcall(rb_ivar_get(self, rb_intern("@cause")), rmid, argc - 1, argv + 1);
33
33
  }
34
34
 
35
+ static VALUE get_cause(VALUE self)
36
+ {
37
+ return rb_funcall(rb_ivar_get(self, rb_intern("@cause")), rb_intern("cause"), 0);
38
+ }
39
+
35
40
  static VALUE exception_to_s(VALUE self)
36
41
  {
37
42
  return rb_funcall(rb_ivar_get(self, rb_intern("@cause")),
@@ -66,6 +71,7 @@ VALUE rjb_get_exception_class(JNIEnv* jenv, jstring str)
66
71
  if (rexp == Qnil)
67
72
  {
68
73
  rexp = rb_define_class(pcls, rb_eStandardError);
74
+ rb_define_method(rexp, "cause", get_cause, 0);
69
75
  rb_define_method(rexp, "method_missing", missing_delegate, -1);
70
76
  rb_define_method(rexp, "to_str", exception_to_s, 0);
71
77
  #if defined(HAVE_RB_HASH_ASET) || defined(RUBINIUS)
Binary file
data/readme.txt CHANGED
@@ -29,7 +29,7 @@ you must set LD_LIBRARY_PATH environmental variable to run rjb.
29
29
  If you'll plan to open the non-ascii character named file by Java class through Rjb, it may require to set LC_ALL environment variable in you sciprt.
30
30
  For example in Rails, set above line in production.rb as your environment.
31
31
  ENV['LC_ALL'] = 'en_us.utf8' # or ja_JP.utf8 etc.
32
- cf: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4733494
32
+ cf: http://bugs.sun.com/view_bug.do?bug_id=4733494
33
33
  (Thanks Paul for this information).
34
34
 
35
35
  artonx@yahoo.co.jp
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -810,6 +810,19 @@ class TestRjb < Test::Unit::TestCase
810
810
  end
811
811
  end
812
812
  end
813
+
814
+
815
+ def test_inner_exception
816
+ test = import('jp.co.infoseek.hp.arton.rjb.Test').new
817
+ begin
818
+ test.cause_exception
819
+ flunk("no exception")
820
+ rescue IllegalStateException => e
821
+ ia = e.cause
822
+ assert_equal('bad argument', ia.message)
823
+ assert_equal('java.lang.IllegalArgumentException', ia._classname)
824
+ end
825
+ end
813
826
 
814
827
  class CbTest
815
828
  def method(l, s, i, d, str)
@@ -878,5 +891,13 @@ class TestRjb < Test::Unit::TestCase
878
891
  assert_equal(32, b.int_value)
879
892
  assert b.compareTo(@jByte._invoke(:valueOf, 'B', 32))
880
893
  end
894
+ def test_typedarray
895
+ test = import('jp.co.infoseek.hp.arton.rjb.Test').new
896
+ uri = import('java.net.URI')
897
+ ret = test.java_typed_array(['a', 'b', 'c'], [1, 2, 3], [uri.new('http://www.artonx.org')])
898
+ assert_equal '[Ljava.lang.String;', ret[0]
899
+ assert_equal '[Ljava.lang.Integer;', ret[1]
900
+ assert_equal '[Ljava.net.URI;', ret[2]
901
+ end
881
902
  end
882
903
 
metadata CHANGED
@@ -1,93 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
5
- prerelease:
4
+ version: 1.4.9
6
5
  platform: x86-mswin32-100
7
6
  authors:
8
7
  - arton
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-18 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description: ! 'RJB is a bridge program that connect between Ruby and Java with Java
15
- Native Interface.
16
-
17
- '
13
+ description: |
14
+ RJB is a bridge program that connect between Ruby and Java with Java Native Interface.
18
15
  email: artonx@gmail.com
19
16
  executables: []
20
17
  extensions: []
21
18
  extra_rdoc_files: []
22
19
  files:
20
+ - COPYING
21
+ - ChangeLog
22
+ - data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
23
23
  - ext/RBridge.java
24
- - ext/rjbexception.c
25
- - ext/rjb.c
26
- - ext/load.c
27
- - ext/riconv.c
24
+ - ext/depend
28
25
  - ext/extconf.h
29
26
  - ext/jniwrap.h
30
27
  - ext/jp_co_infoseek_hp_arton_rjb_RBridge.h
31
- - ext/rjb.h
28
+ - ext/load.c
29
+ - ext/riconv.c
32
30
  - ext/riconv.h
33
- - ext/depend
34
- - data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
35
- - lib/rjbextension.rb
31
+ - ext/rjb.c
32
+ - ext/rjb.h
33
+ - ext/rjbexception.c
36
34
  - lib/rjb.rb
35
+ - lib/rjbcore.so
36
+ - lib/rjbextension.rb
37
+ - readme.sj
38
+ - readme.txt
37
39
  - samples/filechooser.rb
38
40
  - samples/unzip.rb
39
- - test/jartest.rb
40
- - test/gctest.rb
41
- - test/test_osxjvm.rb
42
- - test/test.rb
41
+ - test/Base.class
42
+ - test/CallbackTest$Callback.class
43
+ - test/CallbackTest.class
44
+ - test/ExtBase.class
45
+ - test/IBase.class
46
+ - test/JTest.class
47
+ - test/Test$TestTypes.class
48
+ - test/Test.class
49
+ - test/Two.class
50
+ - test/TwoCaller.class
43
51
  - test/exttest.rb
44
- - test/test_osxload.rb
45
- - test/osx_jvmcheck.rb
52
+ - test/gctest.rb
53
+ - test/jartest.jar
54
+ - test/jartest.rb
55
+ - test/jartest2.jar
46
56
  - test/jartest2.rb
47
57
  - test/jartest3.rb
48
- - test/test_unload.rb
49
- - test/listtest.rb
50
- - test/jp/co/infoseek/hp/arton/rjb/Test.class
51
- - test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
52
58
  - test/jp/co/infoseek/hp/arton/rjb/CallbackTest$Callback.class
53
59
  - test/jp/co/infoseek/hp/arton/rjb/CallbackTest.class
54
60
  - test/jp/co/infoseek/hp/arton/rjb/IBase.class
55
- - test/Two.class
56
- - test/TwoCaller.class
57
- - test/jartest.jar
58
- - test/jartest2.jar
61
+ - test/jp/co/infoseek/hp/arton/rjb/JTest.class
62
+ - test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
63
+ - test/jp/co/infoseek/hp/arton/rjb/Test.class
64
+ - test/listtest.rb
65
+ - test/osx_jvmcheck.rb
59
66
  - test/rjbtest.jar
60
- - COPYING
61
- - ChangeLog
62
- - readme.sj
63
- - readme.txt
64
- - lib/rjbcore.so
67
+ - test/test.rb
68
+ - test/test_osxjvm.rb
69
+ - test/test_osxload.rb
70
+ - test/test_unload.rb
65
71
  homepage: http://rjb.rubyforge.org/
66
- licenses: []
72
+ licenses:
73
+ - LGPL
74
+ metadata: {}
67
75
  post_install_message:
68
76
  rdoc_options: []
69
77
  require_paths:
70
78
  - lib
71
79
  required_ruby_version: !ruby/object:Gem::Requirement
72
- none: false
73
80
  requirements:
74
- - - ! '>='
81
+ - - ">="
75
82
  - !ruby/object:Gem::Version
76
83
  version: 1.8.2
77
84
  required_rubygems_version: !ruby/object:Gem::Requirement
78
- none: false
79
85
  requirements:
80
- - - ! '>='
86
+ - - ">="
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  requirements:
84
90
  - none
85
91
  - JDK 5.0
86
- - ! ' VC6 version of Ruby'
92
+ - " VC6 version of Ruby"
87
93
  rubyforge_project: rjb
88
- rubygems_version: 1.8.23
94
+ rubygems_version: 2.2.0
89
95
  signing_key:
90
- specification_version: 3
96
+ specification_version: 4
91
97
  summary: Ruby Java bridge
92
98
  test_files:
93
99
  - test/test.rb