[libinline-java-perl] 331/398: fixed bug with : as separator

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.55
in repository libinline-java-perl.

commit 7079eba56a9742134b01c74939e6a05a8ffb7c3c
Author: patrick_leb <>
Date:   Mon Jun 21 12:57:50 2004 +0000

    fixed bug with : as separator
---
 Java/Protocol.pm                                       | 5 ++++-
 Java/sources/org/perl/inline/java/InlineJavaClass.java | 2 ++
 t/12_2_perl_objects.t                                  | 8 ++++----
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Java/Protocol.pm b/Java/Protocol.pm
index 9fc2e9f..50f9533 100644
--- a/Java/Protocol.pm
+++ b/Java/Protocol.pm
@@ -293,7 +293,10 @@ sub ValidateArgs {
 			}
 			elsif ($arg =~ /^(.*?)=/){
 				my $id = Inline::Java::Callback::PutObject($arg) ;
-				push @ret, "perl_object:$1:$id" ;
+				# Bug. The delimiter is :, so we need to escape the package separator (::)
+				my $pkg = $1 ;
+				$pkg =~ s/:/\//g ;
+				push @ret, "perl_object:$pkg:$id" ;
 			}
 			else {
 				if (! $callback){
diff --git a/Java/sources/org/perl/inline/java/InlineJavaClass.java b/Java/sources/org/perl/inline/java/InlineJavaClass.java
index 57bd1f6..87e0e75 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaClass.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaClass.java
@@ -240,8 +240,10 @@ class InlineJavaClass {
 				InlineJavaUtils.debug(4, "class " + p.getName() + " is reference") ;
 
 				String pkg = (String)tokens.get(1) ;
+				pkg = pkg.replace('/', ':') ;
 				String objid = (String)tokens.get(2) ;
 
+
 				if (DoesExtend(p, org.perl.inline.java.InlineJavaPerlObject.class) > -1){
 					InlineJavaUtils.debug(4, " Perl object is a kind of " + p.getName()) ;
 					int id = Integer.parseInt(objid) ;
diff --git a/t/12_2_perl_objects.t b/t/12_2_perl_objects.t
index ba5a989..af8f45d 100755
--- a/t/12_2_perl_objects.t
+++ b/t/12_2_perl_objects.t
@@ -21,7 +21,7 @@ my $t = new t16() ;
 
 {
 	eval {
-		my $o = new Obj(name => 'toto') ;
+		my $o = new O::b::j(name => 'toto') ;
 		$t->set($o) ;
 		ok($t->get(), $o) ;
 		ok($t->get()->{name}, 'toto') ;
@@ -36,7 +36,7 @@ my $t = new t16() ;
 		ok($t->add_eval(5, 6), 11) ;
 		check_count(2) ; # po + 1 leaked object
 
-		eval {$t->method_call($o, 'bad', ['bad'])} ; ok($@, qr/Can't locate object method "bad" via package "Obj"/) ;
+		eval {$t->method_call($o, 'bad', ['bad'])} ; ok($@, qr/Can't locate object method "bad" via package "O::b::j"/) ;
 		check_count(3) ; # po + $o + 1 leaked object
 		eval {$t->round_trip({})} ; ok($@, qr/^Can't convert (.*?) to object org.perl.inline.java.InlineJavaPerlObject/) ;
 		eval {$t->error()} ; ok($@, qr/alone/) ;
@@ -45,7 +45,7 @@ my $t = new t16() ;
 		$t->dispose($o) ;
 		check_count(2) ; # 2 leaked objects
 
-		my $jo = $t->create("Obj", ['name', 'titi']) ;
+		my $jo = $t->create("O::b::j", ['name', 'titi']) ;
 		ok($jo->get("name"), 'titi') ;
 		$t->have_fun() ;
 		ok($jo->get('shirt'), qr/lousy t-shirt/) ;
@@ -79,7 +79,7 @@ sub debug_objects {
 }
 
 
-package Obj ;
+package O::b::j ;
 
 sub new {
 	my $class = shift ;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libinline-java-perl.git



More information about the Pkg-perl-cvs-commits mailing list