jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koduru, Rajendra Kumar Reddy" <rajendra.kumar.reddy.kod...@sap.com>
Subject Hi All, Problem with local variables
Date Mon, 07 Feb 2005 16:32:13 GMT
Hi All,

   I have problem with local variables.

	My intention is to insert a statement 

	Object param = methodA(this) at the start of method


	methodB(param, "message") at the end of method

I am using try-finally because i need to jump to finally before each
return statement.

	I could not understand clearly the concept of local variables

What i am doing is 

   I am creating a local variable "param"
   setting the index of this variable to "1" using localVar.setIndex(1)

  and retreiving it by using new ALOAD(1)

  As i am using try-finally, i should catch and rethrow the exception

	so i am storing the exception in localvar 2 in handler
	new ASTORE(2), 
	and retreiving it back by new ALOAD(2), before rethrowing it.

  And I am sotirng the return address in localvar 3 

And the method is modified, when I tried to open it with jad, I cant see
the method , a message is displayed  as following

// JavaClassFileOutputException: get_local_var: index out of range

I treid to find the set of isntructions of this method using javap - c
option, I got the following , which seems to be correct for me

   0:	aload_0
   1:	invokestatic	#986; //Method
   4:	astore_1
   5:	getstatic	#989; //Field
   8:	ldc_w	#1006; //String method call : getCurrentLogonUser
   11:	invokevirtual	#996; //Method
   14:	aload_0
   15:	getfield	#584; //Field
   18:	areturn
   19:	astore_2
   20:	jsr	25
   23:	aload_2
   24:	athrow
   25:	astore_3
   26:	getstatic	#989; //Field
   29:	ldc_w	#1008; //String method exit : getCurrentLogonUser
   32:	invokevirtual	#996; //Method
   35:	aload_1
   36:	ldc_w	#1008; //String method exit : getCurrentLogonUser
   39:	invokestatic	#1002; //Method
   42:	ret	3
  Exception table:
   from   to  target type
    14    19    19   any

Could you please let me know, where I am wrong.. Is it problem with

Cant I set the index of local variables as I like???

Please help me in this regard...

Thank you 

To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org

View raw message