Hi. I have the following
Code:public void validateSoapMessage() throws SAXException, IOException{ SchemaFactory factory = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Source schemaFile = new StreamSource(new File("d:\\request.xsd")); Schema schema = factory.newSchema(schemaFile); Validator validator = schema.newValidator(); BufferedReader in = new BufferedReader(new FileReader("infilename")); String str; while ((str = in.readLine()) != null) { System.out.print(str); } in.close(); }Now when I step through in debug 'Validator validator = schema.newValidator();' throws an exception which gets caught in advice, I then call pjp.proceed for second time, but what this does is execute the first line of validateSoapMessage() when I want it to execute from BufferedReader in = ...Code:@Around("ExceptionPointcuts.validateSoapMessage()") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { // start stopwatch Object retVal = null; try{ retVal = pjp.proceed(); }catch(SAXException ex){ logException(ex); retVal = pjp.proceed(); }catch(IOException ex){ logException(ex); retVal = pjp.proceed(); } return retVal; }


Reply With Quote
