private JAXBElement<ErrorResponse> createXMLParsingErrorResponse(InputStream is,ObjectFactory objFactory,BatchResponse batchResponse,String parserErrorMessage){
  ErrorResponse errorResponse=objFactory.createErrorResponse();
  DSMLContentHandler contentHandler=new DSMLContentHandler();
  try {
    final XMLReader xmlReader=createSafeXMLReader();
    xmlReader.setContentHandler(contentHandler);
    is.reset();
    xmlReader.parse(new InputSource(is));
  }
 catch (  ParserConfigurationException|SAXException|IOException e) {
  }
  if (parserErrorMessage != null) {
    errorResponse.setMessage(parserErrorMessage);
  }
  batchResponse.setRequestID(contentHandler.requestID);
  errorResponse.setType(MALFORMED_REQUEST);
  return objFactory.createBatchResponseErrorResponse(errorResponse);
}

private JAXBElement < ErrorResponse > createXMLParsingErrorResponse ( InputStream is , ObjectFactory objFactory , BatchResponse batchResponse , String parserErrorMessage ) { ErrorResponse errorResponse = objFactory . createErrorResponse ( ) ; DSMLContentHandler contentHandler = new DSMLContentHandler ( ) ; try { final XMLReader xmlReader = createSafeXMLReader ( ) ; xmlReader . setContentHandler ( contentHandler ) ; is . reset ( ) ; xmlReader . parse ( new InputSource ( is ) ) ; } catch ( ParserConfigurationException | SAXException | IOException e ) { } if ( parserErrorMessage != null ) { errorResponse . setMessage ( parserErrorMessage ) ; } batchResponse . setRequestID ( contentHandler . requestID ) ; errorResponse . setType ( MALFORMED_REQUEST ) ; return objFactory . createBatchResponseErrorResponse ( errorResponse ) ; }
returns an error response after a parsing error . the response has the requestid of the batch request , the error response message of the parsing exception message and the type ' malformed request ' .
