1 Reply Latest reply on Mar 21, 2011 1:03 PM by dav.iglesias

    Javassist truncates big class file

    dav.iglesias

      I have a problem with Javassist. When I try to edit a (relatively) big class file (38KB), Javassist will truncate it. It is the biggest class file I have tried editing, so I am asuming it has something to do with the size. Smaller class files have no problem.

       

      The code I am running is this simple:

       

       

      import javassist.*;
      
      public class Test{
          public static void main(String[] args) throws Exception{
              ClassPool pool = ClassPool.getDefault();
              CtClass c = pool.get("com.ehsunbehravesh.mypasswords.gui.MainFrame");
              c.writeFile();
          }
      }
      

       

      And this is the result I get:

       

       

      digles@XXXX:~/mypassbin/MyPasswords$ ls -l com/ehsunbehravesh/mypasswords/gui/MainFrame.class 
      -rw-r--r-- 1 digles XXXX 38201 ene 31 13:53 com/ehsunbehravesh/mypasswords/gui/MainFrame.class
      digles@XXXX:~/mypassbin/MyPasswords$ java Test 
      digles@XXXX:~/mypassbin/MyPasswords$ ls -l com/ehsunbehravesh/mypasswords/gui/MainFrame.class 
      -rw-r--r-- 1 digles XXXX 16384 mar 21 11:09 com/ehsunbehravesh/mypasswords/gui/MainFrame.class
      

       

      Can anybody help me with this? Thanks in advance.