Code Room
Code reviewHard
Question
Review this Java method that parses an inbound SOAP body with a SAX reader.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
public void handleSoap(String soapBody, ContentHandler handler) throws Exception { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); SAXParser parser = spf.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setContentHandler(handler); reader.setErrorHandler(new DefaultHandler()); InputSource src = new InputSource(new StringReader(soapBody)); reader.parse(src); log.info("parsed soap body, {} bytes", soapBody.length());}Run or narrate your approach, then ask the coach.