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

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:23 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 fcc0d0f819e9b7205063af635cad3a601796da52
Author: patrick_leb <>
Date:   Sat Dec 3 01:29:52 2005 +0000

    ok
---
 Java.pm                                            |  3 +-
 Java/Array.pm                                      | 11 +++--
 Java/Class.pm                                      | 28 ++++++++++--
 Java/JNI.xs                                        | 11 +++--
 Java/JVM.pm                                        |  6 ++-
 Java/Protocol.pm                                   | 50 +++++++++++++++++++---
 .../org/perl/inline/java/InlineJavaClass.java      | 28 +++++++++++-
 .../inline/java/InlineJavaPerlInterpreter.java     |  2 +-
 .../org/perl/inline/java/InlineJavaProtocol.java   | 13 +++++-
 .../org/perl/inline/java/InlineJavaServer.java     | 28 +++++++-----
 .../org/perl/inline/java/InlineJavaUtils.java      |  2 +-
 MANIFEST                                           |  2 +
 META.yml                                           |  2 +-
 t/02_primitives.t                                  |  6 +--
 t/13_handles.t                                     | 11 ++++-
 t/14_encoding.t                                    |  2 -
 t/15_native_doubles.t                              |  2 +-
 17 files changed, 164 insertions(+), 43 deletions(-)

diff --git a/Java.pm b/Java.pm
index 6878424..8221ac5 100644
--- a/Java.pm
+++ b/Java.pm
@@ -144,6 +144,7 @@ sub validate {
 	$o->set_option('START_JVM',				1,				'b', 1, \%opts) ;
 	$o->set_option('JNI',					0,				'b', 1, \%opts) ;
 	$o->set_option('EMBEDDED_JNI',			0,				'b', 1, \%opts) ;
+	$o->set_option('NATIVE_DOUBLES',		0,				'b', 1, \%opts) ;
 
 	$o->set_option('WARN_METHOD_SELECT',	0,				'b', 1, \%opts) ;
 	$o->set_option('STUDY',					undef,			'a', 0, \%opts) ;
@@ -486,7 +487,7 @@ sub load {
 		my $pc = new Inline::Java::Protocol(undef, $o) ;
 		$pc->AddClassPath(Inline::Java::Portable::portable("SUB_FIX_JAVA_PATH", Inline::Java::Portable::get_user_jar())) ;
 
-		my ($st, $file_enc, $sock_encs) = $pc->ServerType() ;
+		my $st = $pc->ServerType() ;
 		if ((($st eq "shared")&&(! $o->get_java_config('SHARED_JVM')))||
 			(($st eq "private")&&($o->get_java_config('SHARED_JVM')))){
 			croak "JVM type mismatch on port " . $JVM->{port} ;
diff --git a/Java/Array.pm b/Java/Array.pm
index c4feef5..286e30b 100644
--- a/Java/Array.pm
+++ b/Java/Array.pm
@@ -109,7 +109,7 @@ sub __set_element {
 	# the array.
 	my $java_class = $obj->__get_private()->{java_class} ;
 	my $elem_class = $java_class ;
-	my $an = Inline::Java::Array::Normalizer->new($java_class) ;
+	my $an = Inline::Java::Array::Normalizer->new($obj->__get_private()->{inline}, $java_class) ;
 	if ($an->{req_nb_dim} > 1){
 		$elem_class =~ s/^\[// ;
 	}
@@ -293,6 +293,7 @@ use Carp ;
 
 sub new {
 	my $class = shift ;
+	my $inline = shift ;
 	my $java_class = shift ;
 	my $ref = shift ;
 
@@ -307,6 +308,7 @@ sub new {
 	$this->{ref} = $ref ;
 	$this->{array} = [] ;
 	$this->{score} = 0 ;
+	$this->{inline} = $inline ;
 	
 	bless ($this, $class) ;
 
@@ -339,6 +341,7 @@ sub InitFromArray {
 
 sub InitFromFlat {
 	my $this = shift ;
+	my $inline = shift ;
 	my $dims = shift ;
 	my $list = shift ;
 	my $level = shift ;
@@ -370,8 +373,8 @@ sub InitFromFlat {
 
 			my @dims = @{$dims} ;
 			shift @dims ;
-			my $obj = Inline::Java::Array::Normalizer->new($java_class) ;
-			$obj->InitFromFlat(\@dims, \@sub, $level + 1) ;
+			my $obj = Inline::Java::Array::Normalizer->new($inline, $java_class) ;
+			$obj->InitFromFlat($inline, \@dims, \@sub, $level + 1) ;
 			$elem = $obj->{array} ;
 		}
 		my $nb = scalar(@{$this->{array}}) ;
@@ -537,7 +540,7 @@ sub CastArrayArgument {
 
 	my $element_class = $this->{req_element_class} ;
 
-	my ($new_arg, $score) = Inline::Java::Class::CastArgument($arg, $element_class) ;
+	my ($new_arg, $score) = Inline::Java::Class::CastArgument($arg, $element_class, $this->{inline}) ;
 
 	return ($new_arg, $score) ;
 }
diff --git a/Java/Class.pm b/Java/Class.pm
index 6a1f9ff..50c2cb1 100644
--- a/Java/Class.pm
+++ b/Java/Class.pm
@@ -76,6 +76,12 @@ my %numeric_classes = map {($_ => 1)} qw(
 	double
 ) ;
 
+
+my %double_classes = map {($_ => 1)} qw(
+	java.lang.Double
+	double
+) ;
+
 my %string_classes = map {($_ => 1)} qw(
 	java.lang.String
 	java.lang.StringBuffer
@@ -176,7 +182,7 @@ sub CastArgument {
 			# They will wrapped on the Java side.
 			if (UNIVERSAL::isa($arg, "ARRAY")){
 				if (! UNIVERSAL::isa($arg, "Inline::Java::Array")){
-					my $an = Inline::Java::Array::Normalizer->new($array_type || $proto, $arg) ;
+					my $an = Inline::Java::Array::Normalizer->new($inline, $array_type || $proto, $arg) ;
 					$array_score = $an->{score} ;
 					my $flat = $an->FlattenArray() ; 
 
@@ -229,12 +235,19 @@ sub CastArgument {
 					((! defined($max))||($arg <= $max))){
 					# number is a pretty precise match, but it's still
 					# guessing amongst the numeric types
-					return ($arg, 5.5) ;
+					my $points = 5.5 ;
+					if (($inline->get_java_config('NATIVE_DOUBLES'))&&(ClassIsDouble($proto))){
+						# We want to send the actual double bytes to Java
+						my $bytes = pack("d", $arg) ;
+						$arg = bless(\$bytes, 'Inline::Java::double') ;
+						return ($arg, $points) ;
+					}
+					else {
+						return ($arg, $points) ;
+					}
 				}
 				croak "$arg out of range for type $proto" ;
 			}
-			elsif ($arg =~ /$FLOAT_RE/){
-			}
 			croak "Can't convert $arg to $proto" ;
 		}
 		elsif (ClassIsChar($proto)){
@@ -377,6 +390,13 @@ sub ClassIsNumeric {
 }
 
 
+sub ClassIsDouble {
+	my $class = shift ;
+
+	return $double_classes{$class} ;
+}
+
+
 sub ClassIsString {
 	my $class = shift ;
 
diff --git a/Java/JNI.xs b/Java/JNI.xs
index 86ebbdc..308acc5 100644
--- a/Java/JNI.xs
+++ b/Java/JNI.xs
@@ -16,6 +16,7 @@ typedef struct {
 	jmethodID process_command_mid ;
 	jint debug ;
 	int embedded ;
+	int native_doubles ;
 	int destroyed ;
 } InlineJavaJNIVM ;
 
@@ -131,12 +132,13 @@ PROTOTYPES: DISABLE
 
 
 InlineJavaJNIVM *
-new(CLASS, classpath, args, embedded, debug)
+new(CLASS, classpath, args, embedded, debug, native_doubles)
 	char * CLASS
 	char * classpath
 	AV * args
 	int	embedded
 	int	debug
+	int	native_doubles
 
 	PREINIT:
 	JavaVMInitArgs vm_args ;
@@ -156,8 +158,9 @@ new(CLASS, classpath, args, embedded, debug)
 		croak("Can't create InlineJavaJNIVM") ;
 	}
 	RETVAL->ijs = NULL ;
-	RETVAL->embedded = embedded ;
 	RETVAL->debug = debug ;
+	RETVAL->embedded = embedded ;
+	RETVAL->native_doubles = native_doubles ;
 	RETVAL->destroyed = 0 ;
 
 	/* Figure out the length of the  args array */
@@ -217,7 +220,7 @@ new(CLASS, classpath, args, embedded, debug)
 
 	/* Get the method ids that are needed later */
 	RETVAL->jni_main_mid = (*(env))->GetStaticMethodID(env, RETVAL->ijs_class, "jni_main",
-		"(I)Lorg/perl/inline/java/InlineJavaServer;") ;
+		"(IZ)Lorg/perl/inline/java/InlineJavaServer;") ;
 	check_exception_from_perl(env, "Can't find method jni_main in class InlineJavaServer") ;
 	RETVAL->process_command_mid = (*(env))->GetMethodID(env, RETVAL->ijs_class, "ProcessCommand",
 		"(Ljava/lang/String;)Ljava/lang/String;") ;
@@ -263,7 +266,7 @@ create_ijs(this)
 
 	CODE:
 	env = get_env(this) ;
-	this->ijs = (*(env))->CallStaticObjectMethod(env, this->ijs_class, this->jni_main_mid, this->debug) ;
+	this->ijs = (*(env))->CallStaticObjectMethod(env, this->ijs_class, this->jni_main_mid, this->debug, this->native_doubles) ;
 	check_exception_from_perl(env, "Can't call jni_main in class InlineJavaServer") ;
 	this->ijs = (*(env))->NewGlobalRef(env, this->ijs) ;
 
diff --git a/Java/JVM.pm b/Java/JVM.pm
index 8364675..c6eae9c 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -56,12 +56,13 @@ sub new {
 			\@args,
 			$this->{embedded},
 			Inline::Java::get_DEBUG(),
+			$o->get_java_config('NATIVE_DOUBLES'),
 		) ;
 		$jni->create_ijs() ;
 
 		$this->{JNI} = $jni ;
 	}
-	else{
+	else {
 		Inline::Java::debug(1, "client/server mode") ;
 
 		my $debug = Inline::Java::get_DEBUG() ;
@@ -120,7 +121,8 @@ sub new {
 
 		my $shared = ($this->{shared} ? "true" : "false") ;
 		my $priv = ($this->{private} ? "true" : "false") ;
-		my $cmd = Inline::Java::Portable::portable("SUB_FIX_CMD_QUOTES", "\"$java\" $args org.perl.inline.java.InlineJavaServer $debug $this->{port} $shared $priv") ;
+		my $native_doubles = ($o->get_java_config('NATIVE_DOUBLES') ? "true" : "false") ;
+		my $cmd = Inline::Java::Portable::portable("SUB_FIX_CMD_QUOTES", "\"$java\" $args org.perl.inline.java.InlineJavaServer $debug $this->{port} $shared $priv $native_doubles") ;
 		Inline::Java::debug(2, $cmd) ;
 		if ($o->get_config('UNTAINT')){
 			($cmd) = $cmd =~ /(.*)/ ;
diff --git a/Java/Protocol.pm b/Java/Protocol.pm
index e99030f..59ea80e 100644
--- a/Java/Protocol.pm
+++ b/Java/Protocol.pm
@@ -5,7 +5,9 @@ use Inline::Java::Object ;
 use Inline::Java::Array ;
 use Carp ;
 use MIME::Base64 ;
-use Encode qw(encode_utf8 decode_utf8) ;
+BEGIN {
+	eval "require Encode" ;
+}
 
 $Inline::Java::Protocol::VERSION = '0.50_91' ;
 
@@ -379,6 +381,9 @@ sub ValidateArgs {
 				my $id = $obj->__get_private()->{id} ;
 				push @ret, "java_object:$class:$id" ;
 			}
+			elsif (UNIVERSAL::isa($arg, 'Inline::Java::double')){
+				push @ret, "double:" . encode(${$arg}) ;
+			}
 			elsif ($arg =~ /^(.*?)=/){
 				my $id = Inline::Java::Callback::PutObject($arg) ;
 				# Bug. The delimiter is :, so we need to escape the package separator (::)
@@ -395,7 +400,7 @@ sub ValidateArgs {
 				}
 			}
 		}
-		else{
+		else {
 			push @ret, "scalar:" . encode($arg) ;
 		}
 	}
@@ -444,6 +449,11 @@ sub DeserializeObject {
 	if ($resp =~ /^scalar:([\w+\/=+]*)$/){
 		return decode($1) ; 
 	}
+	elsif ($resp =~ /^double:(.*)$/){
+		my $bytes = decode($1) ;
+		my $d = unpack('d', $bytes) ;
+		return $d ;
+	}
 	elsif ($resp =~ /^undef:$/){
 		return undef ;
 	}
@@ -466,7 +476,7 @@ sub DeserializeObject {
 
 			return undef ;
 		}
-		else{
+		else {
 			my $pkg = $this->{inline}->get_api('pkg') ;
 
 			my $obj = undef ;
@@ -550,14 +560,44 @@ sub DeserializeObject {
 sub encode {
 	my $s = shift ;
 
-	return encode_base64(encode_utf8($s), '') ;
+	# Get UTF-8 byte representation of the data.
+	my $bytes = undef ;
+	if ($INC{'Encode.pm'}){
+		$bytes = Encode::encode_utf8($s) ;
+	}
+	else {
+		$bytes = $s ;
+		$bytes =~ s/([\x80-\xFF])/chr(0xC0|ord($1)>>6).chr(0x80|ord($1)&0x3F)/eg ;
+	}
+
+	# Base-64 encode it.
+	my $base64 = encode_base64($bytes, '') ;
+	
+	return $base64 ;
 }
 
 
 sub decode {
 	my $s = shift ;
 
-	return decode_utf8(decode_base64($s)) ;
+	# Decode the Base-64 data into bytes (UTF-8 representation of the data).
+	my $bytes = decode_base64($s) ;
+
+	# Take the UTF-8 encoding and convert it back to logical characters.
+	my $string = undef ;
+	if ($INC{'Encode.pm'}){
+		$string = Encode::decode_utf8($bytes) ;
+	}
+	else {
+		$string = $bytes ;
+		$bytes =~ s/([\xC2\xC3])([\x80-\xBF])/chr(ord($1)<<6&0xC0|ord($2)&0x3F)/eg ;
+	}
+
+	if (utf8->can('downgrade')){
+		utf8::downgrade($string, 1) ;
+	}
+
+	return $string ;
 }
 
 
diff --git a/Java/sources/org/perl/inline/java/InlineJavaClass.java b/Java/sources/org/perl/inline/java/InlineJavaClass.java
index a90392a..9642f2d 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaClass.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaClass.java
@@ -149,7 +149,18 @@ class InlineJavaClass {
 					throw new InlineJavaCastException("Can't convert " + arg + " to " + ap.getName()) ;
 				}
 			}
-			else{
+			else if (type.equals("double")){
+				String arg = ijp.Decode((String)tokens.get(1)) ;
+				// We have native double bytes in arg.
+				long l = 0 ;
+				char c[] = arg.toCharArray() ;
+				for (int i = 0 ; i < 8 ; i++){
+					l += (((long)c[i]) << (8 * i)) ;
+				}
+				double d = Double.longBitsToDouble(l) ;
+				ret = new Double(d) ;
+			}
+			else {
 				throw new InlineJavaCastException("Can't convert reference to " + p.getName()) ;
 			}
 		}
@@ -375,6 +386,21 @@ class InlineJavaClass {
 	}
 
 
+	static private HashMap double_classes = new HashMap() ;
+	static {
+		Class [] list = {
+			java.lang.Double.class,
+			double.class,
+		} ;
+		for (int i = 0 ; i < list.length ; i++){
+			double_classes.put(list[i], new Boolean(true)) ;
+		}
+	}
+	static boolean ClassIsDouble (Class p){
+		return (double_classes.get(p) != null) ;
+	}
+
+
 	/*
 		Class is String or StringBuffer
 	*/
diff --git a/Java/sources/org/perl/inline/java/InlineJavaPerlInterpreter.java b/Java/sources/org/perl/inline/java/InlineJavaPerlInterpreter.java
index 36856b2..681baa6 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaPerlInterpreter.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaPerlInterpreter.java
@@ -45,7 +45,7 @@ public class InlineJavaPerlInterpreter extends InlineJavaPerlCaller {
 			// Here we create a temporary InlineJavaServer instance in order to be able to instanciate
 			// ourselves. When we create InlineJavaPerlInterpreter, the instance will be overriden.
 			InlineJavaUtils.debug(2, "creating temporary JNI InlineJavaServer") ;
-			InlineJavaServer.jni_main(InlineJavaUtils.debug) ;
+			InlineJavaServer.jni_main(InlineJavaUtils.debug, false) ;
 			InlineJavaUtils.debug(2, "temporary JNI InlineJavaServer created") ;
 			InlineJavaUtils.debug(2, "creating InlineJavaPerlInterpreter") ;
 			instance = new InlineJavaPerlInterpreter() ;
diff --git a/Java/sources/org/perl/inline/java/InlineJavaProtocol.java b/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
index bd50fc1..3d7937d 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
@@ -760,7 +760,18 @@ class InlineJavaProtocol {
 			return "undef:" ;
 		}
 		else if ((ijc.ClassIsNumeric(c))||(ijc.ClassIsChar(c))||(ijc.ClassIsString(c))){
-			return "scalar:" + Encode(o.toString()) ;
+			if ((ijs.GetNativeDoubles())&&(ijc.ClassIsDouble(c))){
+				Double d = (Double)o ;
+				long l = Double.doubleToLongBits(d.doubleValue()) ;
+				char ca[] = new char[8] ;
+				for (int i = 0 ; i < 8 ; i++){
+					ca[i] = (char)((l >> (8 * i)) & 0xFF) ;
+				}
+				return "double:" + Encode(new String(ca)) ;
+			}
+			else {
+				return "scalar:" + Encode(o.toString()) ;
+			}
 		}
 		else if (ijc.ClassIsBool(c)){
 			String b = o.toString() ;
diff --git a/Java/sources/org/perl/inline/java/InlineJavaServer.java b/Java/sources/org/perl/inline/java/InlineJavaServer.java
index 2150a6e..d411b31 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaServer.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaServer.java
@@ -14,6 +14,7 @@ public class InlineJavaServer {
 	private int port = 0 ;
 	private boolean shared_jvm = false ;
 	private boolean priv = false ;
+	private boolean native_doubles = false ;
 
 	private boolean finished = false ;
 	private ServerSocket server_socket = null ;
@@ -26,8 +27,8 @@ public class InlineJavaServer {
 
 
 	// This constructor is used in JNI mode
-	private InlineJavaServer(int debug){
-		init(debug) ;
+	private InlineJavaServer(int debug, boolean _native_doubles){
+		init(debug, _native_doubles) ;
 
 		jni = true ; 
 		AddThread(creator) ;
@@ -36,8 +37,8 @@ public class InlineJavaServer {
 
 	// This constructor is used in server mode
 	// Normally one would then call RunMainLoop()
-	public InlineJavaServer(int debug, int _port, boolean _shared_jvm, boolean _priv){
-		init(debug) ;
+	public InlineJavaServer(int debug, int _port, boolean _shared_jvm, boolean _priv, boolean _native_doubles){
+		init(debug, _native_doubles) ;
 
 		jni = false ;
 		port = _port ;
@@ -80,10 +81,11 @@ public class InlineJavaServer {
 	}
 
 
-	private void init(int debug){
+	private void init(int debug, boolean _native_doubles){
 		instance = this ;
 		creator = Thread.currentThread() ;
 		InlineJavaUtils.debug = debug ;
+		native_doubles = _native_doubles ;
 
 		ijucl = new InlineJavaUserClassLoader() ;
 	}
@@ -103,7 +105,7 @@ public class InlineJavaServer {
 		if (t instanceof InlineJavaServerThread){
 			return ((InlineJavaServerThread)t).GetUserClassLoader() ;
 		}
-		else{
+		else {
 			return ijucl ;
 		}
 	}
@@ -114,6 +116,11 @@ public class InlineJavaServer {
 	}
 
 
+	boolean GetNativeDoubles(){
+		return native_doubles ; 
+	}
+
+
 	boolean IsJNI(){
 		return jni ;
 	}
@@ -296,8 +303,9 @@ public class InlineJavaServer {
 		int port = Integer.parseInt(argv[1]) ;
 		boolean shared_jvm = new Boolean(argv[2]).booleanValue() ;
 		boolean priv = new Boolean(argv[3]).booleanValue() ;
+		boolean native_doubles = new Boolean(argv[4]).booleanValue() ;
 
-		InlineJavaServer ijs = new InlineJavaServer(debug, port, shared_jvm, priv) ;
+		InlineJavaServer ijs = new InlineJavaServer(debug, port, shared_jvm, priv, native_doubles) ;
 		ijs.RunMainLoop() ;
 		System.exit(0) ;
 	}
@@ -307,14 +315,14 @@ public class InlineJavaServer {
 		With PerlInterpreter this is called twice, but we don't want to create
 		a new object the second time.
 	*/
-	public static InlineJavaServer jni_main(int debug){
+	public static InlineJavaServer jni_main(int debug, boolean native_doubles){
 		if (instance != null){
 			InlineJavaUtils.debug = debug ;
 			InlineJavaUtils.debug(1, "recycling InlineJavaServer created by PerlInterpreter") ;
 			return instance ;
 		}
-		else{
-			return new InlineJavaServer(debug) ;
+		else {
+			return new InlineJavaServer(debug, native_doubles) ;
 		}
 	}
 }
diff --git a/Java/sources/org/perl/inline/java/InlineJavaUtils.java b/Java/sources/org/perl/inline/java/InlineJavaUtils.java
index b6191f1..0a56348 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaUtils.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaUtils.java
@@ -58,7 +58,7 @@ class InlineJavaUtils {
 
 	/* 
 		Base64 stuff. This section conatins code by Christian d'Heureuse that is
-		licended under the GPL. Used by permission:
+		licended under the LGPL. Used by permission:
 
 		From: Christian d'Heureuse <chdh at inventec.ch>
 		To: Patrick LeBoutillier <patrick.leboutillier at gmail.com>
diff --git a/MANIFEST b/MANIFEST
index d47e815..32eeaf0 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -72,6 +72,8 @@ t/10_6_shared_sim.t
 t/11_exceptions.t
 t/12_1_callbacks.t
 t/13_handles.t
+t/14_encoding.t
+t/15_native_doubles.t
 t/99_end.t
 t/types.java
 t/types.class
diff --git a/META.yml b/META.yml
index b78524b..a105a54 100644
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Inline-Java
-version:      0.50_90
+version:      0.50_91
 version_from: Java.pm
 installdirs:  site
 requires:
diff --git a/t/02_primitives.t b/t/02_primitives.t
index 139bde8..a35d2db 100644
--- a/t/02_primitives.t
+++ b/t/02_primitives.t
@@ -10,7 +10,7 @@ use Inline (
 
 
 BEGIN {
-	plan(tests => 103) ;
+	plan(tests => 102) ;
 }
 
 
@@ -87,7 +87,7 @@ my $t = new types2() ;
 
 	#
 	# Boundary testing for long, double are not predictable enough
-	# to be reliable.`
+	# to be reliable.
 	#	
 	my $val = 123456 ;
 	ok($t->_long(undef) == 1) ;
@@ -109,6 +109,7 @@ my $t = new types2() ;
 	ok($t->_Double($val) == $val) ;
 	ok($t->_Double("-$val") == -$val) ;
 	
+	
 	# Number is forced to Double
 	ok($t->_Number(undef) == 0) ;
 	ok($t->_Number(0) == 0) ;
@@ -138,7 +139,6 @@ my $t = new types2() ;
 	ok($t->_String(undef), undef) ;
 	ok($t->_String(0), "0") ;
 	ok($t->_String("string"), 'string') ;
-	ok($t->_String("\x{263A}"), "\x{263A}") ;
 
 	my $str = "\r\n&&&\r\n\ntre gfd gf$$ b F D&a;t% R f &p;vf\r\r" ;
 	ok($t->_String($str), $str) ;
diff --git a/t/13_handles.t b/t/13_handles.t
index 31b0007..e744d3d 100755
--- a/t/13_handles.t
+++ b/t/13_handles.t
@@ -14,7 +14,7 @@ use Inline::Java qw(caught) ;
 BEGIN {
 	# Leave previous server enough time to die...
 	sleep(1) ;
-	plan(tests => 13) ;
+	plan(tests => 12) ;
 }
 
 
@@ -39,7 +39,14 @@ my $t = new t13() ;
 	ok(! defined(<$h>)) ;
 }
 
-ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
+
+# It seems that filehandle destruction leaks on certain version
+# of Perl. We will change this test top a warning.
+if ($t->__get_private()->{proto}->ObjectCount() != 1){
+	warn "\nWARNING: Your Perl version ($]) seems to leak tied filehandles. Using\n" .
+		"Inline::Java::Handle objects will result in memory leaks both in Perl\n" .
+		"and in Java\n" ;
+}
 
 
 __END__
diff --git a/t/14_encoding.t b/t/14_encoding.t
index 7b3b801..12d152f 100755
--- a/t/14_encoding.t
+++ b/t/14_encoding.t
@@ -41,8 +41,6 @@ my $t = new t14() ;
 
 	# Mix it up
 	ok($t->_String("$bin\x{E9}\x{263A}"), "$bin\x{E9}\x{263A}") ;
-
-
 }
 
 ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
diff --git a/t/15_native_doubles.t b/t/15_native_doubles.t
index 960fa3b..6036c63 100755
--- a/t/15_native_doubles.t
+++ b/t/15_native_doubles.t
@@ -11,7 +11,7 @@ use Inline (
 
 
 BEGIN {
-	plan(tests => 1) ;
+	plan(tests => 2) ;
 }
 
 

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