[jboss-user] [Javassist] New message: "Re: javassist.bytecode.BadBytecode: unset variable. Please Help Me!"
Arvind K
do-not-reply at jboss.com
Fri Feb 19 07:29:15 EST 2010
User development,
A new message was posted in the thread "javassist.bytecode.BadBytecode: unset variable. Please Help Me!":
http://community.jboss.org/message/527250#527250
Author : Arvind K
Profile : http://community.jboss.org/people/megalodon
Message:
--------------------------------------------------------------
prefixmethod() in brief:
protected void prefixMethod(CtMethod myCtM, String methodName) {
try {
StringBuffer tempSB = new StringBuffer(100);
CtField teTLCtF = new CtField(TLocCtC,TETLName,CtC);
CtC.addField(teTLCtF);
myCtM.addLocalVariable(localMIName,MICtC);
Log2File.writeSpl("prefix Method ");
// === PRINTING THE VARIABLE USING TOSTRING() METHOD ===
tempSB.append("System.out.println(\"MI is \" + " + localMIName + ");");
// EXCEPTION IS THROWN BY NEXT LINE IN THE INSERTBEFORE() METHOD
Log2File.writeSpl(tempSB.toString());myCtM.insertBefore(tempSB.toString());tempSB.setLength(0);
// === INITIALIZING THE LOCAL VARIABLE ===
// MIFQ is a String containing a full class path
// localMIName is a String representing the local variable name
tempSB.append("{"+localMIName + " = new " + MIFQ + "(\"" + this.key + "\",\"" + myCtM.getReturnType().getName() + "\");}");
Log2File.writeSpl(tempSB.toString());myCtM.insertBefore(tempSB.toString());tempSB.setLength(0);
} catch (CannotCompileException cce) {
System.out.println("prefixMethod for " + className + " method name " + methodName + " . signature " + myCtM.getSignature() + " Modifiers " + Modifier.toString(myCtM.getModifiers()));
cce.printStackTrace();
Log2File.writeErr(cce,"prefixMethod for " + className);
}
catch (NotFoundException ntfnde) {
System.out.println("prefixMethod for " + className + " method name " + methodName + ". Exception: " + ntfnde);
ntfnde.printStackTrace();
Log2File.writeErr(ntfnde,"prefixMethod for " + className);
}
}
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/527250#527250
More information about the jboss-user
mailing list