Code Room
Code reviewHardcr-g441
Subject XxeLevel Senior–Staff~22 minCommon in Code quality & review interviewsIndustries Software development, Technology

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.

Talk through your review
Code to reviewjava
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.