Conversation
| logger.log(Level.FINE, "Retrieved XML: \n{0}", xml); | ||
| retval.provideReader(new java.io.StringReader(xml)); | ||
| } catch (java.io.UnsupportedEncodingException e) { | ||
| logger.warning("UnsupportedEncodingException while preparing XML data"); |
There was a problem hiding this comment.
I think we should provide some string back even in the error case. It could be an empty string. Otherwise the UI will get stuck.
There was a problem hiding this comment.
This is one of those "can't realistically happen, but has to be caught" exceptions. It'll only fire if the new String(byteArray, "UTF-8") expression decides that "UTF-8" is not a valid encoding. If that happens, there's something broken deep within Java.
That said, we could still provide something in retval. I'm just not sure what that content should be. An empty string? A minimal CDI with no content inside the <cdi> element?
There was a problem hiding this comment.
ok i misunderstood and thought that broken input utf8 tokens will also cause this error path.
Maybe we should just have a finally { provide(new StringREader("")) }
There was a problem hiding this comment.
actually finally {} is a bad idea. I take that back.
But providing an empty string in the error path is reasonable.
Note: this should be merged after #275