rjb 1.3.5-x86-mswin32-60 → 1.3.8-x86-mswin32-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +19 -0
- data/ext/rjb.c +23 -4
- data/ext/rjbexception.c +8 -1
- data/lib/rjbcore.so +0 -0
- data/test/Two.class +0 -0
- data/test/TwoCaller.class +0 -0
- data/test/test.rb +20 -1
- data/test/test_unload.rb +26 -0
- metadata +7 -14
- data/test/Base.class +0 -0
- data/test/ExtBase.class +0 -0
- data/test/IBase.class +0 -0
- data/test/JTest.class +0 -0
- data/test/JarTest.class +0 -0
- data/test/Test$TestTypes.class +0 -0
- data/test/Test.class +0 -0
- data/test/jp/co/infoseek/hp/arton/rjb/JTest.class +0 -0
data/ChangeLog
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
Sat Dec 03 arton
|
2
|
+
*ext/rjb.c
|
3
|
+
RJB_VERSION -> 1.3.8
|
4
|
+
ignore attach_jvm after rjb was unloaded. (Bug #29451)
|
5
|
+
*test/test_unload.rb
|
6
|
+
add test for unload. if Rjb run after unloading then it causes crush.
|
7
|
+
Wed Nov 09 arton
|
8
|
+
*ext/rjb.c
|
9
|
+
RJB_VERSION -> 1.3.7
|
10
|
+
*test/test.rb (test_reraise_exception)
|
11
|
+
skip test if RUBY_VERSION =~ /^1\.8/
|
12
|
+
Wed Nov 09 arton
|
13
|
+
*ext/rjb.c
|
14
|
+
RJB_VERSION -> 1.3.6
|
15
|
+
*ext/rjbexception.c
|
16
|
+
add to_str method into the exception class.
|
17
|
+
ruby internally calls the method when reraising the exception.
|
18
|
+
*test/test.rb (test_reraise_exception)
|
19
|
+
add reraise test
|
1
20
|
Mon Jul 18 arton
|
2
21
|
*ext/rjb.c
|
3
22
|
fix inhiritance test.
|
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
|
15
|
+
* $Id: rjb.c 178 2011-12-02 16:14:56Z arton $
|
16
16
|
*/
|
17
17
|
|
18
|
-
#define RJB_VERSION "1.3.
|
18
|
+
#define RJB_VERSION "1.3.8"
|
19
19
|
|
20
20
|
#include "ruby.h"
|
21
21
|
#include "extconf.h"
|
@@ -131,6 +131,7 @@ static jmethodID get_system_classloader;
|
|
131
131
|
static jclass j_url_loader;
|
132
132
|
static jobject url_loader;
|
133
133
|
static jmethodID url_loader_new;
|
134
|
+
static jmethodID url_geturls;
|
134
135
|
/* URL global reference */
|
135
136
|
static jclass j_url;
|
136
137
|
static jmethodID url_new;
|
@@ -165,6 +166,7 @@ typedef struct jobject_ruby_table {
|
|
165
166
|
JNIEnv* rjb_attach_current_thread(void)
|
166
167
|
{
|
167
168
|
JNIEnv* env;
|
169
|
+
if (!rjb_jvm) return NULL;
|
168
170
|
(*rjb_jvm)->AttachCurrentThread(rjb_jvm, (void**)&env, '\0');
|
169
171
|
return env;
|
170
172
|
}
|
@@ -1965,8 +1967,11 @@ static VALUE rjb_delete_ref(struct jvi_data* ptr)
|
|
1965
1967
|
static VALUE rj_bridge_free(struct rj_bridge* ptr)
|
1966
1968
|
{
|
1967
1969
|
JNIEnv* jenv = rjb_attach_current_thread();
|
1968
|
-
(
|
1969
|
-
|
1970
|
+
if (jenv)
|
1971
|
+
{
|
1972
|
+
(*jenv)->DeleteLocalRef(jenv, ptr->proxy);
|
1973
|
+
(*jenv)->DeleteLocalRef(jenv, ptr->bridge);
|
1974
|
+
}
|
1970
1975
|
return Qnil;
|
1971
1976
|
}
|
1972
1977
|
|
@@ -2551,6 +2556,8 @@ static VALUE rjb_s_add_jar(VALUE self, VALUE jarname)
|
|
2551
2556
|
"(Ljava/lang/String;)Ljava/lang/Class;");
|
2552
2557
|
RJB_LOAD_METHOD(url_loader_new, j_url_loader, "<init>",
|
2553
2558
|
"([Ljava/net/URL;Ljava/lang/ClassLoader;)V");
|
2559
|
+
RJB_LOAD_METHOD(url_geturls, j_url_loader, "getURLs",
|
2560
|
+
"()[Ljava/net/URL;");
|
2554
2561
|
}
|
2555
2562
|
args[0].l = (*jenv)->NewObjectArray(jenv, (count == 0) ? 1 : count, j_url, NULL);
|
2556
2563
|
rjb_check_exception(jenv, 0);
|
@@ -2575,6 +2582,17 @@ static VALUE rjb_s_add_jar(VALUE self, VALUE jarname)
|
|
2575
2582
|
return Qtrue;
|
2576
2583
|
}
|
2577
2584
|
|
2585
|
+
static VALUE rjb_s_urls(VALUE self)
|
2586
|
+
{
|
2587
|
+
JNIEnv* jenv;
|
2588
|
+
jvalue ret;
|
2589
|
+
if (!url_loader) return Qnil;
|
2590
|
+
jenv = rjb_prelude();
|
2591
|
+
ret.l = (*jenv)->CallObjectMethod(jenv, url_loader, url_geturls);
|
2592
|
+
return jarray2rv(jenv, ret);
|
2593
|
+
}
|
2594
|
+
|
2595
|
+
|
2578
2596
|
/*
|
2579
2597
|
* return class name
|
2580
2598
|
*/
|
@@ -3155,6 +3173,7 @@ void Init_rjbcore()
|
|
3155
3173
|
rb_define_module_function(rjb, "add_classpath", rjb_s_add_classpath, 1);
|
3156
3174
|
rb_define_module_function(rjb, "add_jar", rjb_s_add_jar, 1);
|
3157
3175
|
rb_define_alias(rjb, "add_jars", "add_jar");
|
3176
|
+
rb_define_module_function(rjb, "urls", rjb_s_urls, 0);
|
3158
3177
|
rb_define_const(rjb, "VERSION", rb_str_new2(RJB_VERSION));
|
3159
3178
|
rb_define_class_variable(rjb, "@@classpath", rb_ary_new());
|
3160
3179
|
cvar_classpath = rb_intern("@@classpath");
|
data/ext/rjbexception.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: rjbexception.c
|
15
|
+
* $Id: rjbexception.c 174 2011-11-09 13:47:43Z arton $
|
16
16
|
*/
|
17
17
|
|
18
18
|
#include "ruby.h"
|
@@ -32,6 +32,12 @@ 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 exception_to_s(VALUE self)
|
36
|
+
{
|
37
|
+
return rb_funcall(rb_ivar_get(self, rb_intern("@cause")),
|
38
|
+
rb_intern("toString"), 0);
|
39
|
+
}
|
40
|
+
|
35
41
|
/*
|
36
42
|
* handle Java exception
|
37
43
|
* At this time, the Java exception is defined without the package name.
|
@@ -61,6 +67,7 @@ VALUE rjb_get_exception_class(JNIEnv* jenv, jstring str)
|
|
61
67
|
{
|
62
68
|
rexp = rb_define_class(pcls, rb_eStandardError);
|
63
69
|
rb_define_method(rexp, "method_missing", missing_delegate, -1);
|
70
|
+
rb_define_method(rexp, "to_str", exception_to_s, 0);
|
64
71
|
#if defined(HAVE_RB_HASH_ASET) || defined(RUBINIUS)
|
65
72
|
rb_hash_aset(rjb_loaded_classes, cname, rexp);
|
66
73
|
#else
|
data/lib/rjbcore.so
CHANGED
Binary file
|
data/test/Two.class
CHANGED
Binary file
|
data/test/TwoCaller.class
CHANGED
Binary file
|
data/test/test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/local/env ruby -Ku
|
2
2
|
# encoding: utf-8
|
3
|
-
# $Id: test.rb
|
3
|
+
# $Id: test.rb 176 2011-11-09 14:27:28Z arton $
|
4
4
|
|
5
5
|
begin
|
6
6
|
require 'rjb'
|
@@ -792,5 +792,24 @@ class TestRjb < Test::Unit::TestCase
|
|
792
792
|
assert_equal 'method1', ret[0]
|
793
793
|
assert_equal 'method2', ret[1]
|
794
794
|
end
|
795
|
+
|
796
|
+
def cause_exception
|
797
|
+
begin
|
798
|
+
@jInteger.parseInt('blabla')
|
799
|
+
rescue NumberFormatException => e
|
800
|
+
raise
|
801
|
+
end
|
802
|
+
end
|
803
|
+
|
804
|
+
def test_reraise_exception()
|
805
|
+
unless /^1\.8/ =~ RUBY_VERSION
|
806
|
+
begin
|
807
|
+
cause_exception
|
808
|
+
rescue
|
809
|
+
assert($!.to_s =~ /NumberFormatException/)
|
810
|
+
end
|
811
|
+
end
|
812
|
+
end
|
813
|
+
|
795
814
|
end
|
796
815
|
|
data/test/test_unload.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/local/env ruby -Ku
|
2
|
+
# encoding: utf-8
|
3
|
+
# $Id: test.rb 176 2011-11-09 14:27:28Z arton $
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'rjb'
|
7
|
+
rescue LoadError
|
8
|
+
require 'rubygems'
|
9
|
+
require 'rjb'
|
10
|
+
end
|
11
|
+
require 'test/unit'
|
12
|
+
|
13
|
+
class TestUnloadRjb < Test::Unit::TestCase
|
14
|
+
include Rjb
|
15
|
+
def setup
|
16
|
+
Rjb::load('.')
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_unload
|
20
|
+
jString = import('java.lang.String')
|
21
|
+
assert_equal 0, Rjb::unload
|
22
|
+
jString = nil
|
23
|
+
GC.start
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 11
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 8
|
10
|
+
version: 1.3.8
|
11
11
|
platform: x86-mswin32-60
|
12
12
|
authors:
|
13
13
|
- arton
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-12-03 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -48,21 +48,14 @@ files:
|
|
48
48
|
- samples/unzip.rb
|
49
49
|
- test/test.rb
|
50
50
|
- test/exttest.rb
|
51
|
+
- test/test_unload.rb
|
51
52
|
- test/test_osxjvm.rb
|
52
53
|
- test/gctest.rb
|
53
|
-
- test/jp/co/infoseek/hp/arton/rjb/JTest.class
|
54
54
|
- test/jp/co/infoseek/hp/arton/rjb/IBase.class
|
55
55
|
- test/jp/co/infoseek/hp/arton/rjb/Test.class
|
56
56
|
- test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
|
57
|
-
- test/Base.class
|
58
|
-
- test/JTest.class
|
59
|
-
- test/IBase.class
|
60
|
-
- test/Test.class
|
61
|
-
- test/Test$TestTypes.class
|
62
57
|
- test/TwoCaller.class
|
63
58
|
- test/Two.class
|
64
|
-
- test/JarTest.class
|
65
|
-
- test/ExtBase.class
|
66
59
|
- test/rjbtest.jar
|
67
60
|
- test/jartest.jar
|
68
61
|
- COPYING
|
@@ -104,7 +97,7 @@ requirements:
|
|
104
97
|
- JDK 5.0
|
105
98
|
- " VC6 version of Ruby"
|
106
99
|
rubyforge_project: rjb
|
107
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.3.7
|
108
101
|
signing_key:
|
109
102
|
specification_version: 3
|
110
103
|
summary: Ruby Java bridge
|
data/test/Base.class
DELETED
Binary file
|
data/test/ExtBase.class
DELETED
Binary file
|
data/test/IBase.class
DELETED
Binary file
|
data/test/JTest.class
DELETED
Binary file
|
data/test/JarTest.class
DELETED
Binary file
|
data/test/Test$TestTypes.class
DELETED
Binary file
|
data/test/Test.class
DELETED
Binary file
|
Binary file
|