Re: Illegal signature

Andrew Huntwork <[email protected]>
Newsgroups gmane.comp.jakarta.bcel.devel,gmane.comp.jakarta.bcel.user
Message-ID <[email protected]>
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: [email protected]
> For additional commands, e-mail: [email protected]
> 

-- 
"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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.