Java News from Friday, June 4, 2004

Ken Kast recently identified a bug in XOM related to setting system properties. It turned out I wasn't allowed to do this in an applet due to security restrictions. It was easy enough reproduce the problem and work around it once the bug was noticed. However, once that was done, I ran into a wall. How do I test the fix? In particular, how do I test it in JUnit?

The problem is that the bug only surfaces when an AppletSecurityManager is installed. The obvious solution is to call System.setSecurityManager(new sun.applet.AppletSecurity()) and then run the test. The problem is that as soon as the security manager is installed, JUnit breaks. It turns out JUnit does some very hackish things behind the scenes with reflection that the security maanger doesn't allow, particularly involving reflection; and I can't uninstall the security manager fast enough to allow these to work normally. Has anyone figured out how to use JUnit to test security managed code? Suggestions are appreciated.


Picture of a Cat, Tomcat logo

The Jakarta Apache Project has posted the first beta of Tomcat 5.0.26, an open source servlet container for the Apache web server and the official reference implementation of the Java Servlet API and Java Server Pages (JSP). Tomcat 5.0 implements version 2.4 of the Java Servlet API 2.4 and version 2.0 of Java Server Pages. 5.0.26 is a bug fix release.