Jdk1.6 Use try-with-resources or close this "FileInputStream" in a "finally" clause

I have already close this ,why it still has bug?jdk1.6 how to solve
(upload://55wcYaYER52THdvsrRgXNv92Hcm.jpeg)

private static void unGzip(String src, File target) throws Exception {
		FileInputStream is = null;
		FileOutputStream os = null; 
		GZIPInputStream gis = null;
		int len;
		byte[] buffer = new byte[1024];
		try {
			is = new FileInputStream(new String(src.getBytes(),
					"UTF-8"));
			os = new FileOutputStream(target);
			gis = new GZIPInputStream(is);
			while ((len = gis.read(buffer, 0, buffer.length)) != -1) {
				os.write(buffer, 0, len);
			}
		} catch (Exception e) {
			log.error(e.getMessage());
		} finally {
			if(os != null){
				os.flush();
			}
			if(gis != null){
				try {
					gis.close();
				} catch (IOException e) {
					log.error("inputStream close IOException:"+e.getMessage());
				}
			}
			if(os != null){
				try {
					os.close();
				} catch (IOException e) {
					log.error("inputStream close IOException:"+e.getMessage());
				}
			}
			if(is != null){
				try {
					is.close();
				} catch (IOException e) {
					log.error("inputStream close IOException:"+e.getMessage());
				}
			}
		}

Hi,

Welcome to the community!

In the rule description you should see this notice:

Note that this rule is automatically disabled when the project’s sonar.java.source is lower than 7.

So there’s your answer; just set that analysis property to 6 & you should be good to go.

 
HTH,
Ann