try {
DataAdapter adapter = DataAdapter.getInstance();
// msgID is a required parameter and must be valid
String msgIDStr = request.getParameter("msgID");
if (msgIDStr == null) {
servlet.log("Required parameter 'msgID' was missing");
return new ErrorRenderer("Invalid request");
}
Message msg = adapter.getMessage(Long.parseLong(msgIDStr));
MessageSummary inResponseTo = null;
if (msg.getInReplyTo() > -1) {
inResponseTo = adapter.getMessage(msg.getInReplyTo());
}
return new ViewMsgRenderer(msg, inResponseTo);
} catch (NumberFormatException nfe) {
servlet.log("'msgID' parameter was not a number");
return new ErrorRenderer("Invalid request");
} catch (DataException de) {
return new ErrorRenderer(de);
}