You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by "Nikhil C. Khedkar" <ni...@yahoo.com> on 2004/02/09 10:50:20 UTC

Illegal signature

Hi,
	I have put few instructions in a method after each
line. After I do that I am getting the following
error. Note the ClassLOader has found one input
parameter to the method, which was not there before
and after the method was instrumented. Any clues?

Thanks,
	Nikhil Khedkar

instrumentMethod() : name = <init> signature = ()V
EXITING instrumentMethod() : name = <init> signature =
()V

instrumentMethod() : name = calculate signature =
(II)V
EXITING instrumentMethod() : name = calculate
signature = (II)V

instrumentMethod() : name = exposedAPI signature =
()Ljava/lang/String;
EXITING instrumentMethod() : name = exposedAPI
signature = ()Ljava/lang/String;

instrumentMethod() : name = simpleStatements signature
= ()V
EXITING instrumentMethod() : name = simpleStatements
signature = ()V

instrumentMethod() : name = main signature =
([Ljava/lang/String;)V
EXITING instrumentMethod() : name = main signature =
([Ljava/lang/String;)V

Exception in thread "main" java.lang.ClassFormatError:
com/training/db/Addition

(Method "<init>" has illegal signature "(V)V")
        at java.lang.ClassLoader.defineClass0(Native
Method)
        at
java.lang.ClassLoader.defineClass(ClassLoader.java:502)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at
java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
        at
java.net.URLClassLoader.access$100(URLClassLoader.java:54)
        at
java.net.URLClassLoader$1.run(URLClassLoader.java:193)
        at
java.security.AccessController.doPrivileged(Native
Method)
        at
java.net.URLClassLoader.findClass(URLClassLoader.java:186)
        at
java.lang.ClassLoader.loadClass(ClassLoader.java:299)
        at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
        at
java.lang.ClassLoader.loadClass(ClassLoader.java:255)
        at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)


Here's the code I want to instrument

package com.training.db;

import java.lang.StringBuffer;

public class Addition
{
	private StringBuffer test = new StringBuffer("");

	public Addition()
	{
		test = new StringBuffer("Test Message");
	}

	public void calculate(int i, int j)
	{
		if(i == 0)
		{
			j = j + 5;
		}
		else
		{
			j = j + 5;
		}
	}

	public String exposedAPI()
	{
		simpleStatements();
		int x = 9;
		int j = (x = 55);

		String sName = null;int i = 0;
		return sName;
	}

	private void simpleStatements()
	{
		int x = 12;
		int y = 10;
		System.out.println(x);
		int z = 1 + 6;
	}

	public static void main(String []args) throws
InterruptedException
	{
		System.out.println("main 1");
		Thread.sleep(10000);

		System.out.println("main 2");
		Thread.sleep(10000);
	}
}

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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


Re: Illegal signature

Posted by Andrew Huntwork <as...@huntwork.net>.
If this is the result of the same code you posted with subject 
"Statement v/s Line", the problem is very likely to be
new Type[] { Type.VOID }
you should replace that with Type.NO_ARGS

Nikhil C. Khedkar wrote:
> Hi,
> 	I have put few instructions in a method after each
> line. After I do that I am getting the following
> error. Note the ClassLOader has found one input
> parameter to the method, which was not there before
> and after the method was instrumented. Any clues?
> 
> Thanks,
> 	Nikhil Khedkar
> 
> instrumentMethod() : name = <init> signature = ()V
> EXITING instrumentMethod() : name = <init> signature =
> ()V
> 
> instrumentMethod() : name = calculate signature =
> (II)V
> EXITING instrumentMethod() : name = calculate
> signature = (II)V
> 
> instrumentMethod() : name = exposedAPI signature =
> ()Ljava/lang/String;
> EXITING instrumentMethod() : name = exposedAPI
> signature = ()Ljava/lang/String;
> 
> instrumentMethod() : name = simpleStatements signature
> = ()V
> EXITING instrumentMethod() : name = simpleStatements
> signature = ()V
> 
> instrumentMethod() : name = main signature =
> ([Ljava/lang/String;)V
> EXITING instrumentMethod() : name = main signature =
> ([Ljava/lang/String;)V
> 
> Exception in thread "main" java.lang.ClassFormatError:
> com/training/db/Addition
> 
> (Method "<init>" has illegal signature "(V)V")
>         at java.lang.ClassLoader.defineClass0(Native
> Method)
>         at
> java.lang.ClassLoader.defineClass(ClassLoader.java:502)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
>         at
> java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
>         at
> java.net.URLClassLoader.access$100(URLClassLoader.java:54)
>         at
> java.net.URLClassLoader$1.run(URLClassLoader.java:193)
>         at
> java.security.AccessController.doPrivileged(Native
> Method)
>         at
> java.net.URLClassLoader.findClass(URLClassLoader.java:186)
>         at
> java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>         at
> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
>         at
> java.lang.ClassLoader.loadClass(ClassLoader.java:255)
>         at
> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
> 
> 
> Here's the code I want to instrument
> 
> package com.training.db;
> 
> import java.lang.StringBuffer;
> 
> public class Addition
> {
> 	private StringBuffer test = new StringBuffer("");
> 
> 	public Addition()
> 	{
> 		test = new StringBuffer("Test Message");
> 	}
> 
> 	public void calculate(int i, int j)
> 	{
> 		if(i == 0)
> 		{
> 			j = j + 5;
> 		}
> 		else
> 		{
> 			j = j + 5;
> 		}
> 	}
> 
> 	public String exposedAPI()
> 	{
> 		simpleStatements();
> 		int x = 9;
> 		int j = (x = 55);
> 
> 		String sName = null;int i = 0;
> 		return sName;
> 	}
> 
> 	private void simpleStatements()
> 	{
> 		int x = 12;
> 		int y = 10;
> 		System.out.println(x);
> 		int z = 1 + 6;
> 	}
> 
> 	public static void main(String []args) throws
> InterruptedException
> 	{
> 		System.out.println("main 1");
> 		Thread.sleep(10000);
> 
> 		System.out.println("main 2");
> 		Thread.sleep(10000);
> 	}
> }
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-dev-help@jakarta.apache.org
> 

-- 
"I say to you that the VCR is to the American film
producer and the American public as the Boston
strangler is to the woman home alone."
         -Jack Valenti, President, Motion Picture
          Association of America, Inc., before
          The House Subcommittee on Courts, Civil
          Liberties, and The Administration of
          Justice, August, 1982,
          http://cryptome.org/hrcw-hear.htm


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


Re: Illegal signature

Posted by Andrew Huntwork <as...@huntwork.net>.
If this is the result of the same code you posted with subject 
"Statement v/s Line", the problem is very likely to be
new Type[] { Type.VOID }
you should replace that with Type.NO_ARGS

Nikhil C. Khedkar wrote:
> Hi,
> 	I have put few instructions in a method after each
> line. After I do that I am getting the following
> error. Note the ClassLOader has found one input
> parameter to the method, which was not there before
> and after the method was instrumented. Any clues?
> 
> Thanks,
> 	Nikhil Khedkar
> 
> instrumentMethod() : name = <init> signature = ()V
> EXITING instrumentMethod() : name = <init> signature =
> ()V
> 
> instrumentMethod() : name = calculate signature =
> (II)V
> EXITING instrumentMethod() : name = calculate
> signature = (II)V
> 
> instrumentMethod() : name = exposedAPI signature =
> ()Ljava/lang/String;
> EXITING instrumentMethod() : name = exposedAPI
> signature = ()Ljava/lang/String;
> 
> instrumentMethod() : name = simpleStatements signature
> = ()V
> EXITING instrumentMethod() : name = simpleStatements
> signature = ()V
> 
> instrumentMethod() : name = main signature =
> ([Ljava/lang/String;)V
> EXITING instrumentMethod() : name = main signature =
> ([Ljava/lang/String;)V
> 
> Exception in thread "main" java.lang.ClassFormatError:
> com/training/db/Addition
> 
> (Method "<init>" has illegal signature "(V)V")
>         at java.lang.ClassLoader.defineClass0(Native
> Method)
>         at
> java.lang.ClassLoader.defineClass(ClassLoader.java:502)
>         at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
>         at
> java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
>         at
> java.net.URLClassLoader.access$100(URLClassLoader.java:54)
>         at
> java.net.URLClassLoader$1.run(URLClassLoader.java:193)
>         at
> java.security.AccessController.doPrivileged(Native
> Method)
>         at
> java.net.URLClassLoader.findClass(URLClassLoader.java:186)
>         at
> java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>         at
> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
>         at
> java.lang.ClassLoader.loadClass(ClassLoader.java:255)
>         at
> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
> 
> 
> Here's the code I want to instrument
> 
> package com.training.db;
> 
> import java.lang.StringBuffer;
> 
> public class Addition
> {
> 	private StringBuffer test = new StringBuffer("");
> 
> 	public Addition()
> 	{
> 		test = new StringBuffer("Test Message");
> 	}
> 
> 	public void calculate(int i, int j)
> 	{
> 		if(i == 0)
> 		{
> 			j = j + 5;
> 		}
> 		else
> 		{
> 			j = j + 5;
> 		}
> 	}
> 
> 	public String exposedAPI()
> 	{
> 		simpleStatements();
> 		int x = 9;
> 		int j = (x = 55);
> 
> 		String sName = null;int i = 0;
> 		return sName;
> 	}
> 
> 	private void simpleStatements()
> 	{
> 		int x = 12;
> 		int y = 10;
> 		System.out.println(x);
> 		int z = 1 + 6;
> 	}
> 
> 	public static void main(String []args) throws
> InterruptedException
> 	{
> 		System.out.println("main 1");
> 		Thread.sleep(10000);
> 
> 		System.out.println("main 2");
> 		Thread.sleep(10000);
> 	}
> }
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-dev-help@jakarta.apache.org
> 

-- 
"I say to you that the VCR is to the American film
producer and the American public as the Boston
strangler is to the woman home alone."
         -Jack Valenti, President, Motion Picture
          Association of America, Inc., before
          The House Subcommittee on Courts, Civil
          Liberties, and The Administration of
          Justice, August, 1982,
          http://cryptome.org/hrcw-hear.htm


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