Source:
<code>public AbstractSiteMap parseSiteMap(String contentType, byte[] content, URL url) throws UnknownFormatException, IOException { MediaType mediaType = MediaType.parse(contentType); while (mediaType != null && !mediaType.equals(MediaType.OCTET_STREAM)) { if (XML_MEDIA_TYPES.contains(mediaType)) { return processXml(url, content); } else if (TEXT_MEDIA_TYPES.contains(mediaType)) { return processText(url, content); } else if (GZ_MEDIA_TYPES.contains(mediaType)) { InputStream decompressed; MediaType embeddedType; try { <START> decompressed = new GZIPInputStream(new ByteArrayInputStream(content)); <END> embeddedType = MediaType.parse(TIKA.detect(decompressed)); } catch (Exception e) { UnknownFormatException err = new UnknownFormatException("Failed to detect embedded MediaType of gzipped sitemap: " + url + ", caused by " + e); err.initCause(e); throw err; } if (XML_MEDIA_TYPES.contains(embeddedType)) { return processGzip(url, content); } else if (TEXT_MEDIA_TYPES.contains(embeddedType)) { decompressed = new GZIPInputStream(new ByteArrayInputStream(content)); return processText(url, decompressed); } else if (GZ_MEDIA_TYPES.contains(embeddedType)) { throw new UnknownFormatException("Can't parse gzip recursively: " + url); } throw new UnknownFormatException("Can't parse a gzipped sitemap with the embedded MediaType of: " + embeddedType + " (at: " + url + ")"); } mediaType = MEDIA_TYPE_REGISTRY.getSupertype(mediaType); } throw new UnknownFormatException("Can't parse a sitemap with the MediaType of: " + contentType + " (at: " + url + ")"); }</code><technical_language>try-with-resources stream closed matter happens</technical_language>

Target:
public AbstractSiteMap parseSiteMap(String contentType, byte[] content, URL url) throws UnknownFormatException, IOException { MediaType mediaType = MediaType.parse(contentType); while (mediaType != null && !mediaType.equals(MediaType.OCTET_STREAM)) { if (XML_MEDIA_TYPES.contains(mediaType)) { return processXml(url, content); } else if (TEXT_MEDIA_TYPES.contains(mediaType)) { return processText(url, content); } else if (GZ_MEDIA_TYPES.contains(mediaType)) { InputStream decompressed; MediaType embeddedType; try { decompressed = new GZIPInputStream(new ByteArrayInputStream(content)); embeddedType = MediaType.parse(TIKA.detect(decompressed)); } catch (Exception e) { UnknownFormatException err = new UnknownFormatException("Failed to detect embedded MediaType of gzipped sitemap: " + url + ", caused by " + e); err.initCause(e); throw err; } if (XML_MEDIA_TYPES.contains(embeddedType)) { return processGzippedXML(url, content); } else if (TEXT_MEDIA_TYPES.contains(embeddedType)) { decompressed = new GZIPInputStream(new ByteArrayInputStream(content)); return processText(url, decompressed); } else if (GZ_MEDIA_TYPES.contains(embeddedType)) { throw new UnknownFormatException("Can't parse gzip recursively: " + url); } throw new UnknownFormatException("Can't parse a gzipped sitemap with the embedded MediaType of: " + embeddedType + " (at: " + url + ")"); } mediaType = MEDIA_TYPE_REGISTRY.getSupertype(mediaType); } throw new UnknownFormatException("Can't parse a sitemap with the MediaType of: " + contentType + " (at: " + url + ")"); }