bytecode editor saved the day

Happy new year!

I had a tough simple problem that requires me to change a string in java class. Of course, I don’t have the source code for it. Normally, I would just use decompiler to get the java source and change and recompile. Easy right? this time, the class is so strange in some way that none of the decompilers I used got me a good java code. This is a first time for me. Usually, frontend plus or DJ or Java decompiler do the job really nicely. This time, the java code always had strange codes and lots of labels (remember those Java labels?) anyway, I googled to find those might be related to the fact the original class has a lot of try-catch blocks either stacked or enclosed.  I didn’t want to mess up the java code since I am afraid to introduce bugs into the class. All I wanted to do is to change a string constant which prevented the program from running correctly during network connection (it is a http call class).

So for the first time, I resorted to bytecode editor, which I had only heard of before. After spending a few hours and good size of frustrations, I found cafebabe allowed me to edit that string and save the class file. Hurray! problem solved right away after I injected the new doped class to the original jar file.

Thanks, Cafebabe – http://sourceforge.net/projects/cafebabe

Tony

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s