3 Replies Latest reply: May 23, 2011 2:39 AM by Sebastien Pennec RSS

How can I intercept methods in java.net.* or javax.*.*?

Mehdi Azarmi Newbie

I found this method in the SystemClassLoader.java (JBoss AOP source code)



    * Load jre classes from the parent classloader


    * @param name the class name

    * @return the class

    * @throws ClassNotFoundException when there is no class


   protected Class<?> loadClassByDelegation(String name)

      throws ClassNotFoundException


      // FIXME: Only works for Sun for now

      if (name.startsWith("java.") || name.startsWith("javax.")

         || name.startsWith("sun.") || name.startsWith("com.sun.")

         || name.startsWith("org.apache.xerces.") || name.startsWith("org.xml.sax.")

         || name.startsWith("org.w3c.dom."))

         return getParent().loadClass(name);



      return null;



How can I address this "FIXME"?

Is there any simpler way to intercept those methods?


Thank you,