rjb 1.5.7 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a44bbac6e23b95fd5b2297053622034f4cc8027d656f546bce3d3d2e20646b4
4
- data.tar.gz: 83ff490b4dd8fe79954832e355e4981e5dea72cf3dfbd8350698f869a7ca5eae
3
+ metadata.gz: 2786fa639546b77fac490cfd59ce4b41d52ecb65a45365f73b4e56676f5fef5f
4
+ data.tar.gz: 97c3c18969a236cb79ea8eadb885245e7e43b99561c878f25bd5da50e2f3433b
5
5
  SHA512:
6
- metadata.gz: 9e63eb18a2302be1b83db2e10486104dd5380cbcb7d623c2a2eb6a6203de21f750c03a26c7e6bbd6002adca588ca6d475a12368d72d5790fd6052738770c3ce8
7
- data.tar.gz: 426214a2feae8412362efaabb2cf0c4a49882e5701d0dceb80cb91ea24dc686eebc6c9fdee81a216e692735a86d33c99bc72bf9efaae6b0d631e43f4fa9a4b27
6
+ metadata.gz: c336cae68daa9e4839313bb9f8136d28cbda6cb2e65b921b9e79452b84268ea0e75110841fdbd3947d09602694f480f4d4140ec433dc39fb07cb77f093daaf12
7
+ data.tar.gz: 70af9504c3bda50cfca5cae4eb0d30910557557b71e5ededddadc7324e215cc7f1fd301eeb3d46885d19f8cbc241491d332b32df6de4fdfaca5b8903f22982b7
data/ChangeLog CHANGED
@@ -1,3 +1,10 @@
1
+ Thu Jan 17 2019 arton
2
+ * ext/rjbexception.c
3
+ restore method_missing for the exception class
4
+ * ext/rjb.c
5
+ RJB_VERSION -> 1.5.8
6
+ * test/test.rb
7
+ add #60 test
1
8
  Fri Dec 28 2018 arton
2
9
  * ext/rjbexception.c
3
10
  fix #60; stable java derived exception class for raise
data/ext/rjb.c CHANGED
@@ -14,7 +14,7 @@
14
14
  *
15
15
  */
16
16
 
17
- #define RJB_VERSION "1.5.7"
17
+ #define RJB_VERSION "1.5.8"
18
18
 
19
19
  #include "ruby.h"
20
20
  #include "extconf.h"
@@ -26,6 +26,12 @@
26
26
  #include "riconv.h"
27
27
  #include "rjb.h"
28
28
 
29
+ static VALUE missing_delegate(int argc, VALUE* argv, VALUE self)
30
+ {
31
+ ID rmid = rb_to_id(argv[0]);
32
+ return rb_funcall(rb_ivar_get(self, rb_intern("@cause")), rmid, argc - 1, argv + 1);
33
+ }
34
+
29
35
  static VALUE get_cause(VALUE self)
30
36
  {
31
37
  return rb_funcall(rb_ivar_get(self, rb_intern("@cause")), rb_intern("cause"), 0);
@@ -60,6 +66,7 @@ VALUE rjb_get_exception_class(JNIEnv* jenv, jstring str)
60
66
  {
61
67
  rexp = rb_define_class(pcls, rb_eStandardError);
62
68
  rb_define_method(rexp, "cause", get_cause, 0);
69
+ rb_define_method(rexp, "method_missing", missing_delegate, -1);
63
70
  #if defined(HAVE_RB_HASH_ASET) || defined(RUBINIUS)
64
71
  rb_hash_aset(rjb_loaded_classes, cname, rexp);
65
72
  #else
@@ -933,5 +933,19 @@ class TestRjb < Test::Unit::TestCase
933
933
  assert_equal org.size, len
934
934
  assert_equal org, buffer[0...len]
935
935
  end
936
+
937
+ def test_re_raise
938
+ begin
939
+ @jInteger.parseInt('blabla')
940
+ flunk('no exception')
941
+ rescue NumberFormatException => e
942
+ begin
943
+ raise
944
+ rescue => e
945
+ assert_equal(NumberFormatException, e.class)
946
+ # OK
947
+ end
948
+ end
949
+ end
936
950
  end
937
951
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - arton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-27 00:00:00.000000000 Z
11
+ date: 2019-01-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'RJB is a bridge program that connect between Ruby and Java with Java
14
14
  Native Interface.