What's happening? Consider the following XPage:
You would expect this XPage to output
abca, but it doesn't. It will output
abcand at the same time show the following error on the Domino server's console:
"a"to something with two characters fixed the error and gave the expected output. But feeding it the number
0(which was my original problem) did not.
12on the other hand was fine.
If course, this had to be a bug, so I send a nice little report to Paul Hannan. Unfortunately it's not (so much for street credibility points), and Martin Donnelly explains why:
The com.sun.faces.renderkit.html_basic.HtmlResponseWriter class has overloaded write() methods - like this:
void write(char) void write(char, int, int) void write(int) void write(String) void write(String, int, int)
For writer.write("g"); the engine does not know whether to call void write(char) or void write(String) on the Java side.
To pass in a single character to the writer class that you either:
a) find a non-ambiguous version of a write method and force that to be called,
b) declare the var as an explicit Java type and pass that in
Both are shown here:
var writer = facesContext.getResponseWriter(); writer.write("abc"); writer.write("gh"); //writer.write("g"); //nope // This will work ... writer.write("z",0,1); // So will this ... var r = new java.lang.Character('r'); writer.write(r); writer.endDocument();
This problem can happen easily when you're creating an XAgent. Be careful what you feed the
writer.write(). If you're not, you might get some hard to debug errors.