What's coming in JDK 1.4.2?
Read this article and you will know =)
Tips 'n' Tricks: Prevent NullPointerException in string comparison
Very often I read the following statement:
if (someString.equals("foo")) ...
Now if someString is null this code would produce a nasty NullPointerException. One solution might be:
if ((someString != null) && someString.equals("foo")) ...
But there's a better way:
if ("foo".equals(someString)) ...
Very easy =)
Back from holidays
I had some very nice three weeks in Sachsen, Germany. The weather was great and we had a lot of sun. I had a lot of fun riding on my race bike through the beatiful landscape of Sachsen.
Meanwhile Don Brown contacted me and we talked about integrating my IoC stuff into struts.sf.net. Before we can add the sources we must tune them a little bit first, e.g. package renaming, code style and moving from log4j to commons-logging. Fortunately there are only a handful of files to touch so I think we can add the sources very soon.
Next version of my engine almost done
For the last weeks I was busy on rewriting several parts of my engine. I decided to drop EJBs completely because this way it is possible to use my engine in Tomcat as well. Furthermore I am quite sure that I won't need clustering support any time soon =) The result of the work is a much easier and simplier codebase. Migration to Hibernate 2.0.1 is worth mentioning as well.
JBoss, Jetty, welcome-file and index.do
Unfortunately it is a little bit tricky to get the default welcome file index.do working with Struts and Jetty. Suppose you have th following web.xml:
... <welcome-file-list> <welcome-file>index.do</welcome-file> </welcome-file-list> ...and you have configured the ActionServlet to listen on *.do requests. Then you would assume that
http://some.url.com/index.dowould work? Right? No! I guess the problem is that the default servlet (which handles the welcome-file stuff) looks for the file index.do on the filesystem. Unless there is no such file the ActionSerlvet will never be called.
The trick is to simply add an empty index.do file in the root directory of your WAR. That's it =)