From: Andrew B. <a.g...@le...> - 2006-04-26 10:37:14
|
I've come across what might be a bug in Java 1.5.0 It first showed up when I upgraded our system to 1.5.0 and file uploads stopped working with mvnForum behind a Guanxi guard. They worked fine if mvnForum was not behind the guard. At first I thought this was a problem with Guanxi and contacted Alistair, but I now know the problem actually lies in Java (humble apologies and cakes to Alistair). When an mvnForum user tried to upload a file, he/she was presented with a null pointer exception. This was generated in mvnForum (actually in net.myvietnam.mvncore.fileupload.FileUpload) at the following code: HttpServletRequest req; public static final String CONTENT_TYPE = "Content-type"; String contentType = req.getHeader(CONTENT_TYPE); I put a bit of debugging code into the mvnforum and guanxi code and was able to show that the 'content-type' header was arriving at the guard OK and was being passed through to the mvnForum class when the guard rewrote the request. According to the Java docs, the string passed to request.getHeader() is case insensitive. However, the exception went away when I changed the code to read: public static final String CONTENT_TYPE = "content-type"; Seems the definition of case-insensitive isn't quite what you might expect. Aggie |