/ Programming

A day of crazy debugging and (de)compiling.

A while ago, I had to install a new library for one of our tools. I won't get into the specifics of the tool, but it was setup as a "plugin" for the base platform. You simply put the .jar file in a certain directory and the program will load it up.

After a day or two of it not working, I decided to try some 'alternate ways' of debugging it.

I thought

Ok, it's a jar, just an archive of Java stuff

let's make a temp directory to store my work and explode it

unzip jarry.jar -d jarry

It was full of the usual .properties and .class files so I started exploring.

I looked into one of the properties files and found the names of some of the cookies it used to validate the sessions.....but.....

Found the first issue!

They had the wrong name of a cookie! The cookie they used to grab/validate the user session in Sakai had the wrong name. I went into the properties file and change the cookie to the correct name. Then I started thinking, what else was wrong?

It had two .class files so I had to de-compile them. I forget the exact command/tool used, but I de-compiled them to a .java file and then vim'd into it to see what was inside. Luckily, the de-compilation worked so I was able to see all of the functional code. As I went through the file, I noticed another problem, they weren't setting the cookie correctly. I had to make the change, compile it again using javac and then replace the newly compiled .class file.

The next task wa, I's to repackage the jar with jar -cvf plug.jar jarry.

I then restarted the server and voila! it was working! While I'm pretty sure that I might have possibly broken a license agreement, I'm just happy I got the plugin working.

A day of crazy debugging and (de)compiling.
Share this

Subscribe to Wills Thoughts