Hi there - I found a small tiny problem and think I've solved it.

I'm running cocoon 2.0.2 inside Jboss 3.0 RC 3 (using the Jetty web container) -- works fine!

But living in Denmark I'd like to submit forms containing the ÆØÅ characters; Æ &OSlash; and Å for those speaking HTML. But it seems that the Jetty container is not setting any character encoding on the request and I thus have to set one myself; which is fine 'cause Cocoon ships with the SetCharacterEncodingAction; and I've verified that this action sets up the right character encoding for me -- the characters are propagated to my CMP 2.0 Beans nicely.

If, however, I then add an action that pulls a parameter from the Request (taken from the ObjectModel) - and that parameter is not present in the request, I get a Null Pointer Exception:

java.lang.NullPointerException
at org.apache.cocoon.environment.http.HttpRequest.decode(HttpRequest.java:300)
at org.apache.cocoon.environment.http.HttpRequest.getParameter(HttpRequest.java:293)

   ...(more staktrace)

Because: when the org.apache.cocoon.environment.http.HttpRequest has it's own defined character encoding, it will always call the "decode(String)" method - which assumes that the passed String is non-null.

I know that I can easily work around this - but looking at the other actions in the org.apache.cocoon.acting package I can see that many of them do: "if (request.getParameter("something") != null)" or similar, and thus will start failing if the "SetCharacterEncodingAction" is executed beforehand.

I have made a small correction to the "encode(String)" that checks for null; and it works for me.
The check is merely: if (str == null) return null; as a first test in the method.

I hope this will qualify for CVS ... ;-)

Jakob Dalsgaard
Udvikler
e-mail:   [EMAIL PROTECTED]
Vesterbrogade 149
1620 København V
Tlf.:   70 25 80 30
Fax.: 70 25 80 31

Reply via email to