[libinline-java-perl] 355/398: ok

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:22 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 b07d8264b03dba29a16e34e5149dab9be24e3bd1
Author: patrick_leb <>
Date:   Tue Sep 20 00:20:27 2005 +0000

    ok
---
 CHANGES          |  7 ++++++-
 Java/JNI.xs      | 14 ++++++++++++--
 Java/Object.pm   |  8 +++++++-
 README           |  2 ++
 t/07_polymorph.t |  7 +++++--
 t/09_usages.t    |  4 ++--
 6 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/CHANGES b/CHANGES
index 9b7c03b..9ee043d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
 Revision history for Perl extension Inline::Java
 ------------------------------------------------
-0.51
+0.51  Mon Sep 19 20:17:49 EDT 2005
+    - Several major speed optimizations
+    - Introduction of support for I/O mapping between Perl and Java
+    - Applied patches by Andrew Bruno and Tim Bunce for MAC OSX
+    - JNI fix for system property passing
+        (thanks to Brian Gugliemetti and Jason Stelzer)
     - Other minor bug fixes
 
 0.50  Mon Jan 31 20:14:43 EST 2005
diff --git a/Java/JNI.xs b/Java/JNI.xs
index 74e0a10..f625b30 100644
--- a/Java/JNI.xs
+++ b/Java/JNI.xs
@@ -147,6 +147,7 @@ new(CLASS, classpath, args, embedded, debug)
 	char *cp ;
 	char *al ;
 	char *alsep ;
+	char *tmp ;
 
     CODE:
 	RETVAL = (InlineJavaJNIVM *)safemalloc(sizeof(InlineJavaJNIVM)) ;
@@ -171,8 +172,17 @@ new(CLASS, classpath, args, embedded, debug)
 
 	al = NULL ;
 	if (strlen(args) > 0){
-		al = (char *)malloc((strlen(args) + 1) * sizeof(char)) ;
-		strcpy(al, args) ;
+		tmp = (char *)malloc((strlen(args) + 1) * sizeof(char)) ;
+		strcpy(tmp, args) ;
+		al = (char *)malloc((strlen(tmp) + 1) * sizeof(char)) ;
+		strcpy(al, "") ;
+		alsep = strtok(tmp, "\"'") ;
+		while (alsep != NULL){
+			strcat(al, alsep) ;
+    		alsep = strtok(NULL, "\"'") ;
+		}
+		free(tmp) ;
+
 		alsep = strtok(al, " ") ;
 		while (alsep != NULL){
 			options[vm_args.nOptions++].optionString = alsep ;
diff --git a/Java/Object.pm b/Java/Object.pm
index 1720d59..d055da9 100644
--- a/Java/Object.pm
+++ b/Java/Object.pm
@@ -44,10 +44,16 @@ sub __new {
 	$PRIVATES->{$knot} = $priv ;
 
 	if ($objid <= -1){
+		my $obj = undef ;
 		eval {
-			$this->__get_private()->{proto}->CreateJavaObject($java_class, $proto, $args) ;
+			$obj = $this->__get_private()->{proto}->CreateJavaObject($java_class, $proto, $args) ;
 		} ;		
 		croak $@ if $@ ;
+
+		if (! defined($this->__get_private()->{id})){
+			# Use created a java::lang::String or something...
+			return $obj ;
+		}
 	}
 	else{
 		$this->__get_private()->{id} = $objid ;
diff --git a/README b/README
index ba600e9..796289a 100644
--- a/README
+++ b/README
@@ -70,6 +70,8 @@ Inline::Java version 0.51 is a major upgrade that includes:
     - Several major speed optimizations
 	- Introduction of support for I/O mapping between Perl and Java
     - Applied patches by Andrew Bruno and Tim Bunce for MAC OSX
+	- JNI fix for system property passing 
+        (thanks to Brian Gugliemetti and Jason Stelzer)
     - Other minor bug fixes
 
 See CHANGES for a full change list.
diff --git a/t/07_polymorph.t b/t/07_polymorph.t
index 0990f9d..ed9d0e9 100644
--- a/t/07_polymorph.t
+++ b/t/07_polymorph.t
@@ -6,7 +6,7 @@ use Inline Config =>
 
 use Inline(
 	Java => 'DATA',
-	STUDY => ['java.util.HashMap'],
+	STUDY => ['java.util.HashMap', 'java.lang.String'],
 	AUTOSTUDY => 1,
 ) ;
 
@@ -14,7 +14,7 @@ use Inline::Java qw(cast coerce) ;
 
 
 BEGIN {
-	plan(tests => 23) ;
+	plan(tests => 24) ;
 }
 
 
@@ -65,6 +65,9 @@ my $t = new types7() ;
 	foreach my $e (@{$a}){
 		ok(cast('java.util.Map$Entry', $e)->getKey(), 'key') ;
 	}
+
+	my $str = new java::lang::String('test') ;
+	ok($str, 'test') ;
 }
 
 ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
diff --git a/t/09_usages.t b/t/09_usages.t
index 93badb1..18cb6b8 100755
--- a/t/09_usages.t
+++ b/t/09_usages.t
@@ -27,7 +27,7 @@ use Inline(
 		}
 	|,
 	NAME => 't09::p1',
-	EXTRA_JAVA_ARGS => '-Dprop1=a -Dprop2=b',
+	EXTRA_JAVA_ARGS => '-Dprop1="a:"  -Dprop2=b',
 ) ;
 
 
@@ -61,7 +61,7 @@ my $t = new t09::p1::t09p1() ;
 
 {
 	ok($t->{name}, "p1") ;
-	ok($t->get_prop(1), 'a') ;
+	ok($t->get_prop(1), 'a:') ;
 	ok($t->get_prop(2), 'b') ;
 	ok($t09::p2::t09p2::name . $t09::p3::t09p3::name, "p2p3") ;
 	ok($t09::p2::t09p2::name . $t09::p3::t09p3::name, "p2p3") ;

-- 
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