10 line piece of code for me to understand; Please help if you can
We are running into problems where our BEA instance just hangs and do not respond and even not been able to go and Catch(OFM) exceptions. We wanted in our application that if we do get OFM, we wanted to just catch it and dump the document as not processed and then move onto another request in the queue. First-in-first-out is the requirement.
Please help us understand if following code is bad/ok in dealing with above situation.
byte[] pdfStream =null;
try{
// The following generate PDF Stream
pdfStream = generateDocument(cpRequest, params, document);
if (pdfStream !=null)
{
// successfully create our document
document.setDocumentData(pdfStream);
document.setDocumentStatus(JavaGlobals.NEW_DOC);
document.setDocumentStatusText(JavaGlobals.NEW_DOC_TEXT);
document.setDocumentLength(pdfStream.length);
if (logger.isDebugEnabled()){
logger.debug("call generateOurDocument() successfully");
}
}else{
// Fail to create our document
document.setDocumentStatus(JavaGlobals.FAIL_NEW_DOC);
document.setDocumentStatusText(JavaGlobals.FAIL_NEW_DOC_TEXT);
logger.error("Could not generate our Document");
}
}catch (OutOfMemoryError err){
document.setDocumentStatus(JavaGlobals.SIZE_EXCEEDED_DOC);
document.setDocumentStatusText(JavaGlobals.SIZE_EXCEEDED_DOC_TEXT);
logger.error("Could not generate our Document");
}

