Source:
<code>protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { removeTimedOutStreams(); String streamId = StringUtils.substringBefore(StringUtils.substringAfterLast(req.getRequestURI(), "/"), "."); boolean multiAccess = false; AudioStream stream = oneTimeStreams.remove(streamId); if (stream == null) { stream = multiTimeStreams.get(streamId); if (stream != null) { multiAccess = true; } } if (stream == null) { logger.debug("Received request for invalid stream id at {}", req.getRequestURI()); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { logger.debug("Stream to serve is {}", streamId); String mimeType = null; if (stream.getFormat().getCodec() == AudioFormat.CODEC_MP3) { mimeType = "audio/mpeg"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_WAVE) { mimeType = "audio/wav"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_OGG) { mimeType = "audio/ogg"; } if (mimeType != null) { resp.setContentType(mimeType); } if (stream instanceof FixedLengthAudioStream) { Long size = ((FixedLengthAudioStream) stream).length(); if (size != null) { resp.setContentLength(size.intValue()); } } ServletOutputStream os = resp.getOutputStream(); InputStream is = null; if (multiAccess) { try { is = ((FixedLengthAudioStream) stream).getClonedStream(); } catch (AudioException e) { resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } } else { is = stream; } IOUtils.copy(is, os); resp.flushBuffer(); <START> IOUtils.closeQuietly(stream); <END> } }</code><technical_language>close is ensure cloned stream if multiAccess is true (if is false is is equal stream)</technical_language>

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { removeTimedOutStreams(); String streamId = StringUtils.substringBefore(StringUtils.substringAfterLast(req.getRequestURI(), "/"), "."); boolean multiAccess = false; AudioStream stream = oneTimeStreams.remove(streamId); if (stream == null) { stream = multiTimeStreams.get(streamId); if (stream != null) { multiAccess = true; } } if (stream == null) { logger.debug("Received request for invalid stream id at {}", req.getRequestURI()); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { logger.debug("Stream to serve is {}", streamId); String mimeType = null; if (stream.getFormat().getCodec() == AudioFormat.CODEC_MP3) { mimeType = "audio/mpeg"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_WAVE) { mimeType = "audio/wav"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_OGG) { mimeType = "audio/ogg"; } if (mimeType != null) { resp.setContentType(mimeType); } if (stream instanceof FixedLengthAudioStream) { Long size = ((FixedLengthAudioStream) stream).length(); if (size != null) { resp.setContentLength(size.intValue()); } } ServletOutputStream os = resp.getOutputStream(); InputStream is = null; if (multiAccess) { try { is = ((FixedLengthAudioStream) stream).getClonedStream(); } catch (AudioException e) { resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } } else { is = stream; } IOUtils.copy(is, os); resp.flushBuffer(); IOUtils.closeQuietly(is); } }