[
https://jira.jboss.org/browse/JASSIST-132?page=com.atlassian.jira.plugin....
]
Thomas Mauch commented on JASSIST-132:
--------------------------------------
I am not really sure about the consequenes from your fix.
As far as I understood, trying to instrument the second call
System.out.println(Utils.addStringError("s1", "s2"));
will now fail with BadBytecode instead of ArrayIndexOutOfBounds.
But what about the first call
Utils.addStringError("s1", "s2")
which worked fine until now? Is it rejected right now as well?
That would be unfortunate for my project.
May be I can explain you what I want to achieve. I develop MagicTest
(
http://www.magicwerk.org/magictest) which features an automated visual approach for
testing.
To make things really easy for the developper, he just has to call the method under test
and arguments and results are automatically logged by instrumenting the call.
So if the code is
Utils.addStringError("s1", "s2")
I would use Javassist to convert it into something like
printf("Arguments: %s, %s\n", "s1", "s2");
try {
String s = Utils.addStringError("s1", "s2")
printf("Result: %s\n", s);
}
catch (Throwable t)
printf("Error: %s\n", t.getMessage());
}
What would be best approach for this?
I using try/catch is not allowed any more, I can think of creating a wrapping method doing
the logging stuff and replacing the call to Utils.addStringError with a call to this
wrapping method which will then call Utils.addStringError.
Or what would you propose?
Regards,
Thomas
Replacing an expression with a try-catch statement
--------------------------------------------------
Key: JASSIST-132
URL:
https://jira.jboss.org/browse/JASSIST-132
Project: Javassist
Issue Type: Bug
Affects Versions: 3.13.0.GA
Environment: JDK 1.6.0_18
Reporter: Thomas Mauch
Assignee: Shigeru Chiba
Fix For: 3.14.0.GA
Attachments: bug.zip
Instrumenting fails with ArrayIndexOutOfBoundsException.
I will upload a test case showing the issue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira