[libinline-java-perl] 198/398: Made debugging subsystem better.

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:03 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 77a4fa3fcfbeec0558bdcd0595f7663814492967
Author: patrick_leb <>
Date:   Mon Jun 3 00:14:25 2002 +0000

    Made debugging subsystem better.
---
 Java.pm            |  81 ++++++++++++++++++++++++-----------------------------
 Java.pod           |   2 ++
 Java/Array.pm      |  22 +++++++--------
 Java/Callback.pm   |   2 +-
 Java/Class.pm      |  68 ++++++++++++++++++++++----------------------
 Java/Init.pm       |  80 ++++++++++++++++++++++++----------------------------
 Java/JVM.pm        |  26 ++++++++---------
 Java/Object.pm     |  26 ++++++++---------
 Java/Portable.pm   |  14 ++++-----
 Java/Protocol.pm   |  50 ++++++++++++++++-----------------
 bug/gcj_test.class | Bin 1843 -> 1424 bytes
 t/t1.pl            |   2 +-
 t/types.class      | Bin 485 -> 15 bytes
 13 files changed, 180 insertions(+), 193 deletions(-)

diff --git a/Java.pm b/Java.pm
index b660d38..03c6203 100644
--- a/Java.pm
+++ b/Java.pm
@@ -64,15 +64,15 @@ sub done {
 	$DONE = 1 ;
 
 	if (! $signal){
-		Inline::Java::debug("killed by natural death.") ;
+		Inline::Java::debug(1, "killed by natural death.") ;
 	}
 	else{
-		Inline::Java::debug("killed by signal SIG$signal.") ;
+		Inline::Java::debug(1, "killed by signal SIG$signal.") ;
 	}
 
 	shutdown_JVM() ;
 	
-	Inline::Java::debug("exiting with $ec") ;
+	Inline::Java::debug(1, "exiting with $ec") ;
 
 	CORE::exit($ec) ;
 }
@@ -196,6 +196,7 @@ sub _validate {
 	if (defined($ENV{PERL_INLINE_JAVA_DEBUG})){
 		$Inline::Java::DEBUG = $ENV{PERL_INLINE_JAVA_DEBUG} ;
 	}
+	$Inline::Java::DEBUG = int($Inline::Java::DEBUG) ;
 
 	if (defined($ENV{PERL_INLINE_JAVA_JNI})){
 		$o->{ILSM}->{JNI} = $ENV{PERL_INLINE_JAVA_JNI} ;
@@ -217,7 +218,7 @@ sub _validate {
 		require Inline::Java::JNI ;
 	}
 
-	Inline::Java::debug("validate done.") ;
+	Inline::Java::debug(1, "validate done.") ;
 }
 
 
@@ -326,15 +327,15 @@ sub find_file_in_path {
 	foreach my $p (@{$paths}){
 		$p =~ s/^\s+// ;
 		$p =~ s/\s+$// ;
-		Inline::Java::debug("path element: $p") ;
+		Inline::Java::debug(4, "path element: $p") ;
 		if ($p !~ /^\s*$/){
 			my $found = 0 ;
 			foreach my $file (@{$files}){
 				my $f = File::Spec->catfile($p, $file) ;
-				Inline::Java::debug("  candidate: $f\n") ;
+				Inline::Java::debug(4, " candidate: $f\n") ;
 
 				if (-f $f){
-					Inline::Java::debug("  found file $file in $p") ;
+					Inline::Java::debug(4, " found file $file in $p") ;
 					$found++ ;
 				}
 			}
@@ -397,7 +398,7 @@ sub write_java {
 	Inline::Java::Init::DumpCallbackJavaCode(\*Inline::Java::JAVA) ;
 	close(Inline::Java::JAVA) ;
 
-	Inline::Java::debug("write_java done.") ;
+	Inline::Java::debug(1, "write_java done.") ;
 }
 
 
@@ -427,8 +428,6 @@ sub compile {
 		($cwd) = $cwd =~ /(.*)/ ;
 	}
 
-	my $debug = ($Inline::Java::DEBUG ? "true" : "false") ;
-
 	my $source = ($study_only ? '' : "$modfname.java") ;
 
 	# When we run the commands, we quote them because in WIN32 you need it if
@@ -451,7 +450,7 @@ sub compile {
 				my $func = shift @{$cmd} ;
 				my @args = @{$cmd} ;
 
-				Inline::Java::debug("$func" . "(" . join(", ", @args) . ")") ;
+				Inline::Java::debug(3, "$func" . "(" . join(", ", @args) . ")") ;
 
 				no strict 'refs' ;
 				my $ret = $func->(@args) ;
@@ -464,7 +463,7 @@ sub compile {
 					($cmd) = $cmd =~ /(.*)/ ;
 				}
 
-				Inline::Java::debug("$cmd") ;
+				Inline::Java::debug(3, "$cmd") ;
 				my $res = system($cmd) ;
 				$res and do {
 					croak $o->compile_error_msg($cmd, $cwd) ;
@@ -479,7 +478,7 @@ sub compile {
 		Inline::Java::Portable::rmpath($o, '', $build_dir) ;
 	}
 
-	Inline::Java::debug("compile done.") ;
+	Inline::Java::debug(1, "compile done.") ;
 }
 
 
@@ -544,7 +543,7 @@ sub copy_classes {
 		}
 		my $f = File::Spec->catfile($src_dir, $file) ;
 		my $t = File::Spec->catfile($dest_dir, $file) ;
-		Inline::Java::debug("copy_classes: $file, $t") ;
+		Inline::Java::debug(4, "copy_classes: $file, $t") ;
 		if (! File::Copy::copy($file, $t)){
 			return "Can't copy $f to $t: $!" ;
 		}
@@ -599,7 +598,7 @@ sub load {
 	# Add our Inline object to the list.
 	my $prev_o = $INLINES->{$modfname} ;
 	if (defined($prev_o)){
-		Inline::Java::debug("Module '$modfname' was already loaded, importing binding into new instance") ;
+		Inline::Java::debug(2, "module '$modfname' was already loaded, importing binding into new instance") ;
 		if (! defined($o->{ILSM}->{data})){
 			$o->{ILSM}->{data} = [] ;
 		}
@@ -639,7 +638,7 @@ sub set_classpath {
 
 	$cpall =~ s/\s*\[PERL_INLINE_JAVA\s*=\s*(.*?)\s*\]\s*/{
 		my $modules = $1 ;
-		Inline::Java::debug("   found special CLASSPATH entry: $modules") ;
+		Inline::Java::debug(1, "found special CLASSPATH entry: $modules") ;
 	
 		my @modules = split(m#\s*,\s*#, $modules) ;
 		my $dir = File::Spec->catdir($o->get_config('DIRECTORY'), "lib", "auto") ;
@@ -671,7 +670,7 @@ sub set_classpath {
 
 	$ENV{CLASSPATH} = join($sep, @cp) ;
 
-	Inline::Java::debug("  classpath: " . $ENV{CLASSPATH}) ;
+	Inline::Java::debug(1, "classpath: " . $ENV{CLASSPATH}) ;
 }
 
 
@@ -741,7 +740,7 @@ sub report {
 		# Since we didn't build the module, this means that 
 		# it was up to date. We can therefore use the data 
 		# from the cache
-		Inline::Java::debug("using jdat cache") ;
+		Inline::Java::debug(1, "using jdat cache") ;
 		my $p = File::Spec->catfile($install, "$modfname.$suffix") ;
 		my $size = (-s $p) || 0 ;
 		if ($size > 0){
@@ -762,7 +761,7 @@ sub report {
 
 	if (($use_cache)&&($o->{ILSM}->{built})){
 		# Update the cache.
-		Inline::Java::debug("updating jdat cache") ;
+		Inline::Java::debug(1, "updating jdat cache") ;
 		if (open(Inline::Java::CACHE, ">$install/$modfname.$suffix")){
 			print Inline::Java::CACHE $resp ;
 			close(Inline::Java::CACHE) ;
@@ -782,9 +781,7 @@ sub load_jdat {
 	my $o = shift ;
 	my @lines = @_ ;
 
-	if (Inline::Java::debug_all()){
-		Inline::Java::debug(join("\n", @lines)) ;
-	}
+	Inline::Java::debug(5, join("\n", @lines)) ;
 
 	# We need an array here since the same object can have many 
 	# study sessions.
@@ -858,9 +855,7 @@ sub load_jdat {
 		$idx++ ;
 	}
 
-	if (Inline::Java::debug_all()){
-		Inline::Java::debug_obj($d) ;
-	}
+	Inline::Java::debug_obj($d) ;
 
 	return ($d, $data_idx) ;
 }
@@ -955,9 +950,7 @@ CODE
 			$code .= $o->bind_method($idx, $class, $method) ;
 		}
 
-		if (Inline::Java::debug_all()){
-			Inline::Java::debug($code) ;
-		}
+		Inline::Java::debug(5, $code) ;
 
 		# open (Inline::Java::CODE, ">>code") and print CODE $code and close(CODE) ;
 
@@ -1187,11 +1180,11 @@ sub known_to_perl {
 
 	no strict 'refs' ;
 	if (defined(${$perl_class . "::" . "EXISTS"})){
-		Inline::Java::debug("  Perl knows about '$jclass'") ;
+		Inline::Java::debug(3, "perl knows about '$jclass'") ;
 		return 1 ;
 	}
 	else{
-		Inline::Java::debug("  Perl doesn't know about '$jclass'") ;
+		Inline::Java::debug(3, "perl doesn't know about '$jclass'") ;
 	}
 
 	return 0 ;
@@ -1199,37 +1192,35 @@ sub known_to_perl {
 
 
 sub debug {
-	if ($Inline::Java::DEBUG){
-		my $str = join("", @_) ;
+	my $level = shift ;
+
+	if (($Inline::Java::DEBUG)&&($Inline::Java::DEBUG >= $level)){
+		my $x = " " x $level ;
+		my $str = join("\n$x", @_) ;
 		while (chomp($str)) {}
-		print DEBUG_STREAM "perl $$: $str\n" ;
+		print DEBUG_STREAM sprintf("[perl][%s]$x%s\n", $level, $str) ;
 	}
 }
 
 
 sub debug_obj {
 	my $obj = shift ;
-	my $pre = shift || "perl: " ;
+	my $force = shift || 0 ;
 
-	if ($Inline::Java::DEBUG){
-		print DEBUG_STREAM $pre . Dumper($obj) ;
+	if (($Inline::Java::DEBUG >= 5)||($force)){
+		debug(5, "Dump:\n" . Dumper($obj)) ;
 		if (UNIVERSAL::isa($obj, "Inline::Java::Object")){
 			# Print the guts as well...
-			print DEBUG_STREAM $pre . Dumper($obj->__get_private()) ;
+			debug(5, "Private Dump:" . Dumper($obj->__get_private())) ;
 		}
 	}
 }
 
 
-sub debug_all {
-	return (Inline::Java::get_DEBUG() > 1) ;
-}
-
-
 sub dump_obj {
 	my $obj = shift ;
 
-	return debug_obj($obj, "Java Object Dump:\n") ;
+	return debug_obj($obj, 1) ;
 }
 
 
@@ -1254,7 +1245,7 @@ sub cast {
 sub study_classes {
 	my $classes = shift ;
 
-	Inline::Java::debug("Selecting random module to house studied classes...") ;
+	Inline::Java::debug(2, "selecting random module to house studied classes...") ;
 
 	# Select a random Inline object to be responsible for these
 	# classes
@@ -1263,7 +1254,7 @@ sub study_classes {
 	my $idx = int rand @modules ;
 	my $module = $modules[$idx] ;
 
-	Inline::Java::debug("  Selected $module") ;
+	Inline::Java::debug(2, "selected $module") ;
 
 	my $o = Inline::Java::get_INLINE($module) ;
 
diff --git a/Java.pod b/Java.pod
index 54b89ba..ffe61ae 100644
--- a/Java.pod
+++ b/Java.pod
@@ -813,6 +813,7 @@ If you want to use C<Inline::Java> in a CGI script, do the following:
          }
    END
       SHARED_JVM => 1,
+      DIRECTORY => '/somewhere/your/web/server/can/write',
    ) ;
 
    Inline::Java::release_JVM() ;
@@ -852,6 +853,7 @@ Here is an example of how to use C<Inline::Java> under mod_perl:
          }
    END
       SHARED_JVM => 1,
+      DIRECTORY => '/somewhere/your/web/server/can/write',
    ) ;
 
    Inline::Java::release_JVM() ;
diff --git a/Java/Array.pm b/Java/Array.pm
index e6e7375..8ebe13f 100644
--- a/Java/Array.pm
+++ b/Java/Array.pm
@@ -23,8 +23,8 @@ sub new {
 
 	$OBJECTS->{$knot} = $object ;
 
-	Inline::Java::debug("this = '$this'") ; 
-	Inline::Java::debug("knot = '$knot'") ; 
+	Inline::Java::debug(5, "this = '$this'") ; 
+	Inline::Java::debug(5, "knot = '$knot'") ; 
 
 	return $this ;
 }
@@ -66,7 +66,7 @@ sub length {
 			$obj->__get_private()->{array_length} = $ret ;
 		}
 		else{
-			Inline::Java::debug("Using cached array length $ret") ;
+			Inline::Java::debug(4, "using cached array length $ret") ;
 		}
 	} ;
 	croak $@ if $@ ;
@@ -150,14 +150,14 @@ sub DESTROY {
 
 	my $knot = tied @{$this} ;
 	if (! $knot){
-		Inline::Java::debug("Destroying Inline::Java::Array::Tie") ;
+		Inline::Java::debug(2, "destroying Inline::Java::Array::Tie") ;
 
 		$OBJECTS->{$this} = undef ;
 	}
 	else{
 		# Here we can't untie because we still have a reference in $OBJECTS
 		# untie @{$this} ;
-		Inline::Java::debug("Destroying Inline::Java::Array") ;
+		Inline::Java::debug(2, "destroying Inline::Java::Array") ;
 	}
 }
 
@@ -465,9 +465,9 @@ sub ValidateArray {
 			$max_cells *= $map->{$l}->{max} ;
 		}
 		my $nb_cells = ($map->{$last}->{count} || 0) ;
-		Inline::Java::debug("array is [" . join("][", @dims) . "]") ;
-		Inline::Java::debug("array has         $nb_cells declared cells") ;
-		Inline::Java::debug("array should have $max_cells declared cells") ;
+		Inline::Java::debug(4, "array is [" . join("][", @dims) . "]") ;
+		Inline::Java::debug(4, "array has         $nb_cells declared cells") ;
+		Inline::Java::debug(4, "array should have $max_cells declared cells") ;
 		$this->{dim} = \@dims ;
 		$this->{nb_dim} = scalar(@dims) ;
 
@@ -667,7 +667,7 @@ class InlineJavaArray {
 		int dims[] = new int[size] ;
 		for (int i = 0 ; i < size ; i++){
 			dims[i] = Integer.parseInt((String)al.get(i)) ;
-			ijs.debug("    array dimension: " + (String)al.get(i)) ;
+			ijs.debug(4, "array dimension: " + (String)al.get(i)) ;
 		}
 
 		Object array = null ;
@@ -721,10 +721,10 @@ class InlineJavaArray {
 					Object o = ijc.CastArgument(elem, arg) ;
 					Array.set(array, i, o) ;
 					if (o != null){
-						ijs.debug("      setting array element " + String.valueOf(i) + " to " + o.toString()) ;
+						ijs.debug(4, "setting array element " + String.valueOf(i) + " to " + o.toString()) ;
 					}
 					else{
-						ijs.debug("      setting array element " + String.valueOf(i) + " to " + o) ;
+						ijs.debug(4, "setting array element " + String.valueOf(i) + " to " + o) ;
 					}
 		 		}
 			}
diff --git a/Java/Callback.pm b/Java/Callback.pm
index de02183..ca227f8 100644
--- a/Java/Callback.pm
+++ b/Java/Callback.pm
@@ -50,7 +50,7 @@ sub ProcessCallback {
 			$a ;
 		} @sargs ;
 
-		Inline::Java::debug(" processing callback $module" . "::" . "$function(" . 
+		Inline::Java::debug(2, "processing callback $module" . "::" . "$function(" . 
 			join(", ", @args) . ")") ;
 
 		no strict 'refs' ;
diff --git a/Java/Class.pm b/Java/Class.pm
index d6c69cc..6b2e84d 100644
--- a/Java/Class.pm
+++ b/Java/Class.pm
@@ -157,7 +157,7 @@ sub CastArgument {
 					$arg = new Inline::Java::Array($obj) ;
 				}
 				else{
-					Inline::Java::debug("argument is already an Inline::Java array") ;
+					Inline::Java::debug(4, "argument is already an Inline::Java array") ;
 				}
 			}
 			else{
@@ -188,7 +188,7 @@ sub CastArgument {
 			my $re = $RANGE->{$proto}->{REGEXP} ;
 			my $min = $RANGE->{$proto}->{MIN} ;
 			my $max = $RANGE->{$proto}->{MAX} ;
-			Inline::Java::debug("min = $min, max = $max, val = $arg") ;
+			Inline::Java::debug(4, "min = $min, max = $max, val = $arg") ;
 			if ($arg =~ /$re/){
 				if (($arg >= $min)&&($arg <= $max)){
 					# number is a pretty precise match, but it's still
@@ -255,7 +255,7 @@ sub CastArgument {
 				if ($msg){
 					croak $msg ;
 				}
-				Inline::Java::debug("$arg is a $proto") ;
+				Inline::Java::debug(3, "$arg is a $proto") ;
 
 				# a matching object, pretty good match, except if proto
 				# is java.lang.Object
@@ -285,7 +285,7 @@ sub CastArgument {
 	if ((defined($arg_ori))&&(UNIVERSAL::isa($arg_ori, "Inline::Java::Class::Cast"))){
 		# It seems we had casted the variable to a specific type
 		if ($arg_ori->matches($proto_ori)){
-			Inline::Java::debug("Type cast match!") ;
+			Inline::Java::debug(3, "type cast match!") ;
 			$ret[1] = $Inline::Java::Class::MAX_SCORE ;
 		}
 		else{
@@ -530,7 +530,7 @@ class InlineJavaClass {
 			// Here the args are all strings or objects (or undef)
 			// we need to match them to the prototype.
 			Class p = params[i] ;
-			ijs.debug("    arg " + String.valueOf(i) + " of signature is " + p.getName()) ;
+			ijs.debug(4, "arg " + String.valueOf(i) + " of signature is " + p.getName()) ;
 
 			ret[i] = CastArgument(p, (String)args.get(i)) ;
 		}
@@ -561,28 +561,28 @@ class InlineJavaClass {
 		if ((num)||(ClassIsString(p))){
 			Class ap = p ;
 			if (ap == java.lang.Number.class){
-				ijs.debug(" specializing java.lang.Number to java.lang.Double") ;
+				ijs.debug(4, "specializing java.lang.Number to java.lang.Double") ;
 				ap = java.lang.Double.class ;
 			}
 
 			if (type.equals("undef")){
 				if (num){
-					ijs.debug("  args is undef -> forcing to " + ap.getName() + " 0") ;
+					ijs.debug(4, "args is undef -> forcing to " + ap.getName() + " 0") ;
 					ret = ijp.CreateObject(ap, new Object [] {"0"}, new Class [] {String.class}) ;
-					ijs.debug("    result is " + ret.toString()) ;
+					ijs.debug(4, " result is " + ret.toString()) ;
 				}
 				else{
 					ret = null ;
-					ijs.debug("  args is undef -> forcing to " + ap.getName() + " " + ret) ;
-					ijs.debug("    result is " + ret) ;
+					ijs.debug(4, "args is undef -> forcing to " + ap.getName() + " " + ret) ;
+					ijs.debug(4, " result is " + ret) ;
 				}
 			}
 			else if (type.equals("scalar")){
 				String arg = ijp.pack((String)tokens.get(1)) ;
-				ijs.debug("  args is scalar -> forcing to " + ap.getName()) ;
+				ijs.debug(4, "args is scalar -> forcing to " + ap.getName()) ;
 				try	{
 					ret = ijp.CreateObject(ap, new Object [] {arg}, new Class [] {String.class}) ;
-					ijs.debug("    result is " + ret.toString()) ;
+					ijs.debug(4, " result is " + ret.toString()) ;
 				}
 				catch (NumberFormatException e){
 					throw new InlineJavaCastException("Can't convert " + arg + " to " + ap.getName()) ;
@@ -594,13 +594,13 @@ class InlineJavaClass {
 		}
 		else if (ClassIsBool(p)){
 			if (type.equals("undef")){
-				ijs.debug("  args is undef -> forcing to bool false") ;
+				ijs.debug(4, "args is undef -> forcing to bool false") ;
 				ret = new Boolean("false") ;
-				ijs.debug("    result is " + ret.toString()) ;
+				ijs.debug(4, " result is " + ret.toString()) ;
 			}
 			else if (type.equals("scalar")){
 				String arg = ijp.pack(((String)tokens.get(1)).toLowerCase()) ;
-				ijs.debug("  args is scalar -> forcing to bool") ;
+				ijs.debug(4, "args is scalar -> forcing to bool") ;
 				if ((arg.equals(""))||(arg.equals("0"))){
 					arg = "false" ;
 				}
@@ -608,7 +608,7 @@ class InlineJavaClass {
 					arg = "true" ;
 				}
 				ret = new Boolean(arg) ;
-				ijs.debug("    result is " + ret.toString()) ;
+				ijs.debug(4, " result is " + ret.toString()) ;
 			}
 			else{
 				throw new InlineJavaCastException("Can't convert reference to " + p.getName()) ;
@@ -616,13 +616,13 @@ class InlineJavaClass {
 		}
 		else if (ClassIsChar(p)){
 			if (type.equals("undef")){
-				ijs.debug("  args is undef -> forcing to char '\0'") ;
+				ijs.debug(4, "args is undef -> forcing to char '\0'") ;
 				ret = new Character('\0') ;
-				ijs.debug("    result is " + ret.toString()) ;
+				ijs.debug(4, " result is " + ret.toString()) ;
 			}
 			else if (type.equals("scalar")){
 				String arg = ijp.pack((String)tokens.get(1)) ;
-				ijs.debug("  args is scalar -> forcing to char") ;
+				ijs.debug(4, "args is scalar -> forcing to char") ;
 				char c = '\0' ;
 				if (arg.length() == 1){
 					c = arg.toCharArray()[0] ;
@@ -631,17 +631,17 @@ class InlineJavaClass {
 					throw new InlineJavaCastException("Can't convert " + arg + " to " + p.getName()) ;
 				}
 				ret = new Character(c) ;
-				ijs.debug("    result is " + ret.toString()) ;
+				ijs.debug(4, " result is " + ret.toString()) ;
 			}
 			else{
 				throw new InlineJavaCastException("Can't convert reference to " + p.getName()) ;
 			}
 		}
 		else {
-			ijs.debug("  class " + p.getName() + " is reference") ;
+			ijs.debug(4, "class " + p.getName() + " is reference") ;
 			// We know that what we expect here is a real object
 			if (type.equals("undef")){
-				ijs.debug("  args is undef -> forcing to null") ;
+				ijs.debug(4, "args is undef -> forcing to null") ;
 				ret = null ;
 			}
 			else if (type.equals("scalar")){
@@ -657,7 +657,7 @@ class InlineJavaClass {
 			}
 			else{
 				// We need an object and we got an object...
-				ijs.debug("  class " + p.getName() + " is reference") ;
+				ijs.debug(4, "class " + p.getName() + " is reference") ;
 
 				String c_name = (String)tokens.get(1) ;
 				String objid = (String)tokens.get(2) ;
@@ -665,7 +665,7 @@ class InlineJavaClass {
 				Class c = ValidateClass(c_name) ;
 
 				if (DoesExtend(c, p) > -1){
-					ijs.debug("    " + c.getName() + " is a kind of " + p.getName()) ;
+					ijs.debug(4, " " + c.getName() + " is a kind of " + p.getName()) ;
 					// get the object from the hash table
 					int id = Integer.parseInt(objid) ;
 					Object o = ijs.GetObject(id) ;
@@ -690,7 +690,7 @@ class InlineJavaClass {
 
 
 	int DoesExtend(Class a, Class b, int level){
-		ijs.debug("   checking if " + a.getName() + " extends " + b.getName()) ;
+		ijs.debug(4, "checking if " + a.getName() + " extends " + b.getName()) ;
 
 		if (a == b){
 			return level ;
@@ -698,7 +698,7 @@ class InlineJavaClass {
 
 		Class parent = a.getSuperclass() ;
 		if (parent != null){
-			ijs.debug("    parent is " + parent.getName()) ;
+			ijs.debug(4, " parent is " + parent.getName()) ;
 			int ret = DoesExtend(parent, b, level + 1) ;
 			if (ret != -1){
 				return ret ;
@@ -708,7 +708,7 @@ class InlineJavaClass {
 		// Maybe b is an interface a implements it?
 		Class inter[] = a.getInterfaces() ;
 		for (int i = 0 ; i < inter.length ; i++){
-			ijs.debug("    interface is " + inter[i].getName()) ;
+			ijs.debug(4, " interface is " + inter[i].getName()) ;
 			int ret = DoesExtend(inter[i], b, level + 1) ;
 			if (ret != -1){
 				return ret ;
@@ -812,7 +812,7 @@ class InlineJavaClass {
 			return true ;
 		}
 
-		ijs.debug("  class " + name + " is reference") ;
+		ijs.debug(4, "class " + name + " is reference") ;
 		return false ;
 	}
 
@@ -841,7 +841,7 @@ class InlineJavaClass {
 
 		for (int i = 0 ; i < list.length ; i++){
 			if (p == list[i]){
-				ijs.debug("  class " + name + " is primitive numeric") ;
+				ijs.debug(4, "class " + name + " is primitive numeric") ;
 				return true ;
 			}
 		}
@@ -863,7 +863,7 @@ class InlineJavaClass {
 
 		for (int i = 0 ; i < list.length ; i++){
 			if (p == list[i]){
-				ijs.debug("  class " + name + " is primitive string") ;
+				ijs.debug(4, "class " + name + " is primitive string") ;
 				return true ;
 			}
 		}
@@ -885,7 +885,7 @@ class InlineJavaClass {
 
 		for (int i = 0 ; i < list.length ; i++){
 			if (p == list[i]){
-				ijs.debug("  class " + name + " is primitive char") ;
+				ijs.debug(4, "class " + name + " is primitive char") ;
 				return true ;
 			}
 		}
@@ -907,7 +907,7 @@ class InlineJavaClass {
 
 		for (int i = 0 ; i < list.length ; i++){
 			if (p == list[i]){
-				ijs.debug("  class " + name + " is primitive bool") ;
+				ijs.debug(4, "class " + name + " is primitive bool") ;
 				return true ;
 			}
 		}
@@ -927,7 +927,7 @@ class InlineJavaClass {
 			return false ;
 		}
 
-		ijs.debug("  class " + name + " is reference") ;
+		ijs.debug(4, "class " + name + " is reference") ;
 
 		return true ;
 	}
@@ -936,7 +936,7 @@ class InlineJavaClass {
 		String name = p.getName() ;
 
 		if ((ClassIsReference(p))&&(name.startsWith("["))){
-			ijs.debug("  class " + name + " is array") ;
+			ijs.debug(4, "class " + name + " is array") ;
 			return true ;
 		}
 
diff --git a/Java/Init.pm b/Java/Init.pm
index 70d3fe5..fb0b022 100644
--- a/Java/Init.pm
+++ b/Java/Init.pm
@@ -67,7 +67,7 @@ import java.lang.reflect.* ;
 */
 public class InlineJavaServer {
 	static public InlineJavaServer instance = null ;
-	private boolean debug ;
+	private int debug ;
 	private int port = 0 ;
 	private boolean shared_jvm = false ;
 
@@ -75,7 +75,7 @@ public class InlineJavaServer {
 	private int objid = 1 ;
 
 	// This constructor is used in JNI mode
-	InlineJavaServer(boolean d) {
+	InlineJavaServer(int d) {
 		init() ;
 		debug = d ;
 
@@ -96,7 +96,7 @@ public class InlineJavaServer {
 			System.err.flush() ;
 		}
 
-		debug = new Boolean(argv[0]).booleanValue() ;
+		debug = new Integer(argv[0]).intValue() ;
 		port = Integer.parseInt(argv[1]) ;
 		shared_jvm = new Boolean(argv[2]).booleanValue() ;
 
@@ -153,30 +153,30 @@ public class InlineJavaServer {
 	}
 
 	private String ProcessCommand(String cmd, boolean addlf) {
-		debug("  packet recv is " + cmd) ;
+		debug(3, "packet recv is " + cmd) ;
 
 		String resp = null ;
 		if (cmd != null){
 			InlineJavaProtocol ijp = new InlineJavaProtocol(this, cmd) ;
 			try {
 				ijp.Do() ;
-				debug("  packet sent is " + ijp.response) ;
+				debug(3, "packet sent is " + ijp.response) ;
 				resp = ijp.response ;
 			}
 			catch (InlineJavaException e){
 				String err = "error scalar:" + ijp.unpack(e.getMessage()) ;
-				debug("  packet sent is " + err) ;
+				debug(3, "packet sent is " + err) ;
 				resp = err ;
 			}
 		}
 		else{
 			if (! shared_jvm){
 				// Probably connection dropped...
-				debug("  Lost connection with client in single client mode. Exiting.") ;
+				debug(1, "lost connection with client in single client mode. Exiting.") ;
 				System.exit(1) ;
 			}
 			else{
-				debug("  Lost connection with client in shared JVM mode.") ;
+				debug(1, "lost connection with client in shared JVM mode.") ;
 				return null ;
 			}
 		}
@@ -222,45 +222,35 @@ public class InlineJavaServer {
 	}
 
 
-	public Object DeleteObject(int id) {
+	public Object DeleteObject(int id) throws InlineJavaException {
 		Object o = null ;
-		try {
-			String name = Thread.currentThread().getName() ;
-			HashMap h = (HashMap)thread_objects.get(name) ;
+		String name = Thread.currentThread().getName() ;
+		HashMap h = (HashMap)thread_objects.get(name) ;
 
-			if (h == null){
-				throw new InlineJavaException("Can't find thread " + name + "!") ;
-			}
-			else{
-				o = h.remove(new Integer(id)) ;
-				if (o == null){
-					throw new InlineJavaException("Can't find object " + id + " for thread " + name) ;
-				}
-			}
+		if (h == null){
+			throw new InlineJavaException("Can't find thread " + name + "!") ;
 		}
-		catch (InlineJavaException e){
-			debug(e.getMessage()) ;
+		else{
+			o = h.remove(new Integer(id)) ;
+			if (o == null){
+				throw new InlineJavaException("Can't find object " + id + " for thread " + name) ;
+			}
 		}
 
 		return o ;
 	}
 
 
-	public int ObjectCount() {
+	public int ObjectCount() throws InlineJavaException {
 		int i = -1 ;
-		try {
-			String name = Thread.currentThread().getName() ;
-			HashMap h = (HashMap)thread_objects.get(name) ;
+		String name = Thread.currentThread().getName() ;
+		HashMap h = (HashMap)thread_objects.get(name) ;
 
-			if (h == null){
-				throw new InlineJavaException("Can't find thread " + name + "!") ;
-			}
-			else{
-				i = h.values().size() ;
-			}
+		if (h == null){
+			throw new InlineJavaException("Can't find thread " + name + "!") ;
 		}
-		catch (InlineJavaException e){
-			debug(e.getMessage()) ;
+		else{
+			i = h.values().size() ;
 		}
 
 		return i ;
@@ -280,12 +270,12 @@ public class InlineJavaServer {
 				}
 			}
 			String cmd = cmdb.toString() ;
-			debug(" callback command: " + cmd) ;
+			debug(2, "callback command: " + cmd) ;
 
 			Thread t = Thread.currentThread() ;
 			String resp = null ;
 			while (true) {			
-				debug("  packet sent (callback) is " + cmd) ;
+				debug(3, "packet sent (callback) is " + cmd) ;
 				if (t instanceof InlineJavaThread){
 					// Client-server mode
 					InlineJavaThread ijt = (InlineJavaThread)t ;
@@ -298,7 +288,7 @@ public class InlineJavaServer {
 					// JNI mode
 					resp = jni_callback(cmd) ;
 				}
-				debug(" packet recv (callback) is " + resp) ;
+				debug(3, "packet recv (callback) is " + resp) ;
 
 				StringTokenizer st = new StringTokenizer(resp, " ") ;
 				String c = st.nextToken() ;
@@ -315,7 +305,7 @@ public class InlineJavaServer {
 				}	
 				else{
 					// Pass it on through the regular channel...
-					debug(" packet is not callback response: " + resp) ;
+					debug(3, "packet is not callback response: " + resp) ;
 					cmd = ProcessCommand(resp, false) ;
 
 					continue ;
@@ -354,9 +344,13 @@ public class InlineJavaServer {
 	}
 
 
-	synchronized public void debug(String s) {
-		if (debug){
-			System.err.println("java: " + s) ;
+	synchronized public void debug(int level, String s) {
+		if ((debug > 0)&&(debug >= level)){
+			StringBuffer sb = new StringBuffer() ;
+			for (int i = 0 ; i < level ; i++){
+				sb.append(" ") ;				
+			}
+			System.err.println("[java][" + level + "]" + sb.toString() + s) ;
 			System.err.flush() ;
 		}
 	}
@@ -370,7 +364,7 @@ public class InlineJavaServer {
 	}
 
 
-	public static InlineJavaServer jni_main(boolean debug) {
+	public static InlineJavaServer jni_main(int debug) {
 		return new InlineJavaServer(debug) ;
 	}
 	
diff --git a/Java/JVM.pm b/Java/JVM.pm
index c914522..1c55dd3 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -34,11 +34,11 @@ sub new {
 
 	$this->{destroyed} = 0 ;
 
-	Inline::Java::debug("Starting JVM...") ;
+	Inline::Java::debug(1, "starting JVM...") ;
 
 	if ($o->get_java_config('JNI')){
 		$this->{owner} = 1 ;
-		Inline::Java::debug("  JNI mode") ;
+		Inline::Java::debug(1, "JNI mode") ;
 
 		my $jni = new Inline::Java::JNI(
 			$ENV{CLASSPATH} || "",
@@ -49,9 +49,9 @@ sub new {
 		$this->{JNI} = $jni ;
 	}
 	else{
-		Inline::Java::debug("  Client/Server mode") ;
+		Inline::Java::debug(1, "client/server mode") ;
 
-		my $debug = (Inline::Java::get_DEBUG() ? "true" : "false") ;
+		my $debug = Inline::Java::get_DEBUG() ;
 
 		$this->{shared} = $o->get_java_config('SHARED_JVM') ;
 		$this->{port} = $o->get_java_config('PORT') ;
@@ -63,7 +63,7 @@ sub new {
 				$this->reconnect() ;
 			} ;
 			if (! $@){
-				Inline::Java::debug("  Connected to already running JVM!") ;
+				Inline::Java::debug(1, "connected to already running JVM!") ;
 				return $this ;
 			}
 		}
@@ -74,7 +74,7 @@ sub new {
 
 		my $shared_arg = ($this->{shared} ? "true" : "false") ;
 		my $cmd = "\"$java\" InlineJavaServer $debug $this->{port} $shared_arg" ;
-		Inline::Java::debug($cmd) ;
+		Inline::Java::debug(1, $cmd) ;
 
 		if ($o->get_config('UNTAINT')){
 			($cmd) = $cmd =~ /(.*)/ ;
@@ -185,13 +185,13 @@ sub shutdown {
 
 	if (! $this->{destroyed}){
 		if ($this->am_owner()){
-			Inline::Java::debug("JVM owner exiting...") ;
+			Inline::Java::debug(1, "JVM owner exiting...") ;
 
 			if ($this->{socket}){
 				# This asks the Java server to stop and die.
 				my $sock = $this->{socket} ;
 				if ($sock->peername()){
-					Inline::Java::debug("Sending 'die' message to JVM...") ;
+					Inline::Java::debug(1, "Sending 'die' message to JVM...") ;
 					print $sock "die\n" ;
 				}
 				else{
@@ -203,9 +203,9 @@ sub shutdown {
 					# Here we go ahead and send the signals anyway to be very 
 					# sure it's dead...
 					# Always be polite first, and then insist.
-					Inline::Java::debug("Sending 15 signal to JVM...") ;
+					Inline::Java::debug(1, "Sending 15 signal to JVM...") ;
 					kill(15, $this->{pid}) ;
-					Inline::Java::debug("Sending 9 signal to JVM...") ;
+					Inline::Java::debug(1, "Sending 9 signal to JVM...") ;
 					kill(9, $this->{pid}) ;
 		
 					# Reap the child...
@@ -219,7 +219,7 @@ sub shutdown {
 		else{
 			# We are not the JVM owner, so we simply politely disconnect
 			if ($this->{socket}){
-				Inline::Java::debug("JVM non-owner exiting...") ;
+				Inline::Java::debug(1, "JVM non-owner exiting...") ;
 				close($this->{socket}) ;
 				$this->{socket} = undef ;
 			}
@@ -368,7 +368,7 @@ sub process_command {
 
 	my $resp = undef ;
 	while (1){
-		Inline::Java::debug("  packet sent is $data") ;
+		Inline::Java::debug(3, "packet sent is $data") ;
 
 		if ($this->{socket}){
 			my $sock = $this->{socket} ;
@@ -389,7 +389,7 @@ sub process_command {
 			$resp = $this->{JNI}->process_command($data) ;
 		}
 
-		Inline::Java::debug("  packet recv is $resp") ;
+		Inline::Java::debug(3, "packet recv is $resp") ;
 
 		# We got an answer from the server. Is it a callback?
 		if ($resp =~ /^callback/){
diff --git a/Java/Object.pm b/Java/Object.pm
index c59b2a8..32995af 100644
--- a/Java/Object.pm
+++ b/Java/Object.pm
@@ -53,7 +53,7 @@ sub __new {
 	}
 	else{
 		$this->__get_private()->{id} = $objid ;
-		Inline::Java::debug("Object created in java ($class):") ;
+		Inline::Java::debug(2, "object created in java ($class):") ;
 	}
 
 	Inline::Java::debug_obj($this) ;
@@ -97,7 +97,7 @@ sub __validate_prototype {
 		my $score = undef ;
 
 		my $sig = Inline::Java::Protocol->CreateSignature($proto) ;
-		Inline::Java::debug("Matching arguments to $method$sig") ;
+		Inline::Java::debug(3, "matching arguments to $method$sig") ;
 		
 		eval {
 			($new_args, $score) = Inline::Java::Class::CastArguments($args, $proto, $inline->get_api('modfname')) ;
@@ -108,12 +108,12 @@ sub __validate_prototype {
 				croak $@ ;
 			}
 			push @errors, $@ ;
-			Inline::Java::debug("Error trying to fit args to prototype: $@") ;
+			Inline::Java::debug(3, "error trying to fit args to prototype: $@") ;
 			next ;
 		}
 
 		# We passed!
-		Inline::Java::debug("Match successful: score is $score") ;
+		Inline::Java::debug(3, "match successful: score is $score") ;
 		my $h = {
 			PROTO =>	$proto,
 			NEW_ARGS =>	$new_args,
@@ -126,7 +126,7 @@ sub __validate_prototype {
 		# Tiny optimization: abort if type cast was used and matched for
 		# every parameter
 		if (Inline::Java::Class::IsMaxArgumentsScore($new_args, $score)){
-			Inline::Java::debug("Perfect match found, aborting search") ;
+			Inline::Java::debug(3, "perfect match found, aborting search") ;
 			@matched = () ;
 			push @matched, $h ;
 			last ;
@@ -237,7 +237,7 @@ sub __get_member {
 		croak "Can't get member '$key' for an object that is not bound to Perl" ;
 	}
 
-	Inline::Java::debug("fetching member variable '$key'") ;
+	Inline::Java::debug(3, "fetching member variable '$key'") ;
 
 	my $inline = Inline::Java::get_INLINE($this->__get_private()->{module}) ;
 	my $fields = $inline->get_fields($this->__get_private()->{class}) ;
@@ -256,7 +256,7 @@ sub __get_member {
 		my $proto = $sign->{TYPE} ;
 
 		my $ret = $this->__get_private()->{proto}->GetJavaMember($key, [$proto], [undef]) ;
-		Inline::Java::debug("returning member (" . ($ret || '') . ")") ;
+		Inline::Java::debug(3, "returning member (" . ($ret || '') . ")") ;
 	
 		return $ret ;
 	}
@@ -314,7 +314,7 @@ sub AUTOLOAD {
 	# method.
 	$func_name =~ s/^(.*)::// ;
 
-	Inline::Java::debug("$func_name") ;
+	Inline::Java::debug(5, "$func_name") ;
 
 	my $name = (ref($this) ? $this->__get_private()->{class} : $this) ;
 	if ($name eq "Inline::Java::Object"){
@@ -330,7 +330,7 @@ sub DESTROY {
 	
 	my $knot = tied %{$this} ;
 	if (! $knot){
-		Inline::Java::debug("Destroying Inline::Java::Object::Tie") ;
+		Inline::Java::debug(2, "destroying Inline::Java::Object::Tie") ;
 		
 		if (! Inline::Java::get_DONE()){
 			if (! $this->__get_private()->{weak_ref}){
@@ -366,17 +366,17 @@ sub DESTROY {
 				$PRIVATES->{$this} = undef ;
 			}
 			else{
-				Inline::Java::debug(" Object marked a weak reference, object destruction not propagated to Java") ;
+				Inline::Java::debug(2, "object marked as weak reference, object destruction not propagated to Java") ;
 			}
 		}
 		else{
-			Inline::Java::debug(" Script marked as DONE, object destruction not propagated to Java") ;
+			Inline::Java::debug(2, "script marked as DONE, object destruction not propagated to Java") ;
 		}
 	}
 	else{
 		# Here we can't untie because we still have a reference in $PRIVATES
 		# untie %{$this} ;
-		Inline::Java::debug("Destroying Inline::Java::Object") ;
+		Inline::Java::debug(2, "destroying Inline::Java::Object") ;
 	}
 }
 
@@ -539,7 +539,7 @@ sub new {
 sub DESTROY {
 	my $this = shift ;
 
-	Inline::Java::debug("Destroying Inline::Java::Object::Private") ;
+	Inline::Java::debug(2, "destroying Inline::Java::Object::Private") ;
 }
 
 
diff --git a/Java/Portable.pm b/Java/Portable.pm
index 2022dfe..671f96f 100644
--- a/Java/Portable.pm
+++ b/Java/Portable.pm
@@ -148,11 +148,11 @@ sub portable {
 				my $f = $map->{$^O}->{$key}->[0] ;
 				my $t = $map->{$^O}->{$key}->[1] ;
 				$val =~ s/$f/$t/g ;
-				Inline::Java::Portable::debug("portable: $key => $val for $^O is '$val'") ;
+				Inline::Java::Portable::debug(4, "portable: $key => $val for $^O is '$val'") ;
 				return $val ;
 			}
 			else{
-				Inline::Java::Portable::debug("portable: $key for $^O is 'undef'") ;
+				Inline::Java::Portable::debug(4, "portable: $key for $^O is 'undef'") ;
 				return undef ;
 			}
 		}
@@ -160,7 +160,7 @@ sub portable {
 			my $sub = $map->{$^O}->{$key} ;
 			if (defined($sub)){
 				$val = $sub->($val) ;
-				Inline::Java::Portable::debug("portable: $key => $val for $^O is '$val'") ;
+				Inline::Java::Portable::debug(4, "portable: $key => $val for $^O is '$val'") ;
 				return $val ;
 			}
 			else{
@@ -168,21 +168,21 @@ sub portable {
 			}
 		}
 		else{
-			Inline::Java::Portable::debug("portable: $key for $^O is '$map->{$^O}->{$key}'") ;
+			Inline::Java::Portable::debug(4, "portable: $key for $^O is '$map->{$^O}->{$key}'") ;
 			return $map->{$^O}->{$key} ;
 		}
 	}
 	else{
 		if ($key =~ /^RE_/){
-			Inline::Java::Portable::debug("portable: $key => $val for $^O is default '$val'") ;
+			Inline::Java::Portable::debug(4, "portable: $key => $val for $^O is default '$val'") ;
 			return $val ;
 		}
 		if ($key =~ /^SUB_/){
-			Inline::Java::Portable::debug("portable: $key => $val for $^O is default '$val'") ;
+			Inline::Java::Portable::debug(4, "portable: $key => $val for $^O is default '$val'") ;
 			return $val ;
 		}
 		else{
-			Inline::Java::Portable::debug("portable: $key for $^O is default '$defmap->{$key}'") ;
+			Inline::Java::Portable::debug(4, "portable: $key for $^O is default '$defmap->{$key}'") ;
 			return $defmap->{$key} ;
 		}
 	}
diff --git a/Java/Protocol.pm b/Java/Protocol.pm
index 8c8f6de..54cd0bf 100644
--- a/Java/Protocol.pm
+++ b/Java/Protocol.pm
@@ -27,7 +27,7 @@ sub new {
 sub ServerType {
 	my $this = shift ;
 
-	Inline::Java::debug("getting server type") ;
+	Inline::Java::debug(3, "getting server type") ;
 
 	my $data = "server_type" ;
 
@@ -39,7 +39,7 @@ sub Report {
 	my $this = shift ;
 	my $classes = shift ;
 
-	Inline::Java::debug("reporting on $classes") ;
+	Inline::Java::debug(3, "reporting on $classes") ;
 
 	my $data = join(" ", 
 		"report", 
@@ -56,7 +56,7 @@ sub ISA {
 
 	my $class = $this->{obj_priv}->{java_class} ;
 
-	Inline::Java::debug("checking if $class is a $proto") ;
+	Inline::Java::debug(3, "checking if $class is a $proto") ;
 
 	my $data = join(" ", 
 		"isa", 
@@ -71,7 +71,7 @@ sub ISA {
 sub ObjectCount {
 	my $this = shift ;
 
-	Inline::Java::debug("getting object count") ;
+	Inline::Java::debug(3, "getting object count") ;
 
 	my $data = join(" ", 
 		"obj_cnt", 
@@ -88,7 +88,7 @@ sub CreateJavaObject {
 	my $proto = shift ;
 	my $args = shift ;
 
-	Inline::Java::debug("creating object new $class" . $this->CreateSignature($args)) ; 	
+	Inline::Java::debug(3, "creating object new $class" . $this->CreateSignature($args)) ; 	
 
 	my $data = join(" ", 
 		"create_object", 
@@ -110,7 +110,7 @@ sub CallJavaMethod {
 
 	my $id = $this->{obj_priv}->{id} ;
 	my $class = $this->{obj_priv}->{java_class} ;
-	Inline::Java::debug("calling object($id).$method" . $this->CreateSignature($args)) ;
+	Inline::Java::debug(3, "calling object($id).$method" . $this->CreateSignature($args)) ;
 
 	my $data = join(" ", 
 		"call_method", 
@@ -134,7 +134,7 @@ sub SetJavaMember {
 
 	my $id = $this->{obj_priv}->{id} ;
 	my $class = $this->{obj_priv}->{java_class} ;
-	Inline::Java::debug("setting object($id)->{$member} = " . ($arg->[0] || '')) ;
+	Inline::Java::debug(3, "setting object($id)->{$member} = " . ($arg->[0] || '')) ;
 	my $data = join(" ", 
 		"set_member", 
 		$id,
@@ -156,7 +156,7 @@ sub GetJavaMember {
 
 	my $id = $this->{obj_priv}->{id} ;
 	my $class = $this->{obj_priv}->{java_class} ;
-	Inline::Java::debug("getting object($id)->{$member}") ;
+	Inline::Java::debug(3, "getting object($id)->{$member}") ;
 
 	my $data = join(" ", 
 		"get_member", 
@@ -180,7 +180,7 @@ sub DeleteJavaObject {
 		my $id = $this->{obj_priv}->{id} ;
 		my $class = $this->{obj_priv}->{java_class} ;
 
-		Inline::Java::debug("deleting object $obj $id ($class)") ;
+		Inline::Java::debug(3, "deleting object $obj $id ($class)") ;
 
 		my $data = join(" ", 
 			"delete_object", 
@@ -281,7 +281,7 @@ sub Send {
 
 	if ($resp =~ /^error scalar:([\d.]*)$/){
 		my $msg = pack("C*", split(/\./, $1)) ;
-		Inline::Java::debug("  packet recv error: $msg") ;
+		Inline::Java::debug(3, "packet recv error: $msg") ;
 		croak $msg ;
 	}
 	elsif ($resp =~ s/^ok //){
@@ -328,7 +328,7 @@ sub DeserializeObject {
 			my $obj = undef ;
 			my $elem_class = $class ;
 
-			Inline::Java::debug("checking if stub is array...") ;
+			Inline::Java::debug(3, "checking if stub is array...") ;
 			if (Inline::Java::Class::ClassIsArray($class)){
 				my @d = Inline::Java::Class::ValidateClassSplit($class) ;
 				$elem_class = $d[2] ;
@@ -359,17 +359,17 @@ sub DeserializeObject {
 			}
 
 			if (Inline::Java::Class::ClassIsArray($class)){
-				Inline::Java::debug("creating array object...") ;
+				Inline::Java::debug(3, "creating array object...") ;
 				$obj = Inline::Java::Object->__new($class, $inline, $id) ;
 				$obj = new Inline::Java::Array($obj) ;
-				Inline::Java::debug("array object created...") ;
+				Inline::Java::debug(3, "array object created...") ;
 			}
 			else{
 				$obj = $perl_class->__new($class, $inline, $id) ;
 			}
 
 			if ($thrown){
-				Inline::Java::debug("throwing stub...") ;
+				Inline::Java::debug(3, "throwing stub...") ;
 				my ($msg, $score) = $obj->__isa('InlineJavaPerlCaller$PerlException') ;
 				if ($msg){
 					die $obj ;
@@ -379,7 +379,7 @@ sub DeserializeObject {
 				}
 			}
 			else{
-				Inline::Java::debug("returning stub...") ;
+				Inline::Java::debug(3, "returning stub...") ;
 				return $obj ;
 			}
 		}
@@ -393,7 +393,7 @@ sub DeserializeObject {
 sub DESTROY {
 	my $this = shift ;
 
-	Inline::Java::debug("Destroying Inline::Java::Protocol") ;
+	Inline::Java::debug(2, "destroying Inline::Java::Protocol") ;
 }
 
 
@@ -460,7 +460,7 @@ class InlineJavaProtocol {
 			ObjectCount(st) ;
 		}
 		else if (c.equals("die")){
-			ijs.debug("  received a request to die...") ;
+			ijs.debug(1, "received a request to die...") ;
 			System.exit(0) ;
 		}
 		else {
@@ -490,7 +490,7 @@ class InlineJavaProtocol {
 			String name = (String)class_list.get(i) ;
 			Class c = ijc.ValidateClass(name) ;
 
-			ijs.debug("reporting for " + c) ;
+			ijs.debug(3, "reporting for " + c) ;
 													
 			pw.append("class " + c.getName() + "\n") ;
 			Constructor constructors[] = c.getConstructors() ;
@@ -598,7 +598,7 @@ class InlineJavaProtocol {
 
 			Class ec = ijc.ValidateClass(sb.toString()) ;
 
-			ijs.debug("    array elements: " + ec.getName()) ;
+			ijs.debug(4, "array elements: " + ec.getName()) ;
 			Object o = ija.CreateArray(ec, st) ;
 			SetResponse(o) ;
 		}
@@ -647,7 +647,7 @@ class InlineJavaProtocol {
 				Throwable t = e.getTargetException() ;
 				String type = t.getClass().getName() ;
 				String msg = t.getMessage() ;
-				ijs.debug("Method " + name + " in class " + class_name + " threw exception " + type + ": " + msg) ;
+				ijs.debug(1, "method " + name + " in class " + class_name + " threw exception " + type + ": " + msg) ;
 				if (t instanceof InlineJavaPerlCaller.InlineJavaException){
 					throw ((InlineJavaPerlCaller.InlineJavaException)t).GetException() ;
 				}
@@ -833,7 +833,7 @@ class InlineJavaProtocol {
 			Member m = ma[i] ;
 
 			if (m.getName().equals(name)){
-				ijs.debug("found a " + name + (constructor ? " constructor" : " method")) ;
+				ijs.debug(3, "found a " + name + (constructor ? " constructor" : " method")) ;
 
 				if (constructor){
 					params = ((Constructor)m).getParameterTypes() ;
@@ -844,10 +844,10 @@ class InlineJavaProtocol {
 
 				// Now we check if the signatures match
 				String sign = ijs.CreateSignature(params, ",") ;
-				ijs.debug(sign + " = " + signature + "?") ;
+				ijs.debug(3, sign + " = " + signature + "?") ;
 
 				if (signature.equals(sign)){
-					ijs.debug("  has matching signature " + sign) ;
+					ijs.debug(3, "has matching signature " + sign) ;
 					ml.add(ml.size(), m) ;
 					break ;
 				}
@@ -918,12 +918,12 @@ class InlineJavaProtocol {
 			Field f = fa[i] ;
 
 			if (f.getName().equals(name)){
-				ijs.debug("found a " + name + " member") ;
+				ijs.debug(3, "found a " + name + " member") ;
 
 				param = f.getType() ;
 				String t = param.getName() ;
 				if (type.equals(t)){
-					ijs.debug("  has matching type " + t) ;
+					ijs.debug(3, "has matching type " + t) ;
 					fl.add(fl.size(), f) ;
 				}
 			}
diff --git a/bug/gcj_test.class b/bug/gcj_test.class
index fad3e96..d3fa658 100644
Binary files a/bug/gcj_test.class and b/bug/gcj_test.class differ
diff --git a/t/t1.pl b/t/t1.pl
index ce07beb..2d85283 100755
--- a/t/t1.pl
+++ b/t/t1.pl
@@ -19,7 +19,7 @@ use Inline (
 			}
 		}
 	|, 
-	PRINT_INFO => 1,
+	# PRINT_INFO => 1,
 ) ;
 
 Inline::Java::release_JVM() ;
diff --git a/t/types.class b/t/types.class
index 6c8e580..fc9e393 100644
Binary files a/t/types.class and b/t/types.class differ

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