Source:
protected void unzipSchemaFile() throws IOException { ZipInputStream zipFileStream = null; try { FileInputStream schemaFileStream = new FileInputStream(this.zipSchemaStore); zipFileStream = new ZipInputStream(new BufferedInputStream(schemaFileStream)); ZipEntry entry; String basePath = this.schemaDirectory.getAbsolutePath(); while ((entry = zipFileStream.getNextEntry()) != null) { if (entry.isDirectory()) { File newDirectory = new File(basePath, entry.getName()); if (!newDirectory.mkdir()) { throw new IOException("Unable to create directory - " + newDirectory.getAbsolutePath()); } continue; } int size; byte[] buffer = new byte[2048]; FileOutputStream extractedSchemaFile = new FileOutputStream( new File(basePath, entry.getName())); BufferedOutputStream extractingBufferedStream = new BufferedOutputStream(extractedSchemaFile, buffer.length); try { while ((size = zipFileStream.read(buffer, 0, buffer.length)) != -1) { extractingBufferedStream.write(buffer, 0, size); } } finally { IdentityIOStreamUtils.closeOutputStream(extractingBufferedStream); } } } catch (IOException e) { String msg = "Unable to extract schema directory to location " + this.schemaDirectory.getAbsolutePath() + " from " + this.zipSchemaStore.getAbsolutePath(); logger.error(msg, e); throw new IOException(msg, e); }finally{ IdentityIOStreamUtils.closeInputStream(zipFileStream); } if (logger.isDebugEnabled()) { logger.debug("Successfully extracted schema files to path " + this.schemaDirectory.getAbsolutePath() + " using schema zip file " + this.zipSchemaStore.getAbsolutePath()); } }

Target:
protected void unzipSchemaFile() throws IOException { ZipInputStream zipFileStream = null; try { FileInputStream schemaFileStream = new FileInputStream(this.zipSchemaStore); zipFileStream = new ZipInputStream(new BufferedInputStream(schemaFileStream)); ZipEntry entry; String basePath = this.schemaDirectory.getAbsolutePath(); while ((entry = zipFileStream.getNextEntry()) != null) { if (entry.isDirectory()) { File newDirectory = new File(basePath, entry.getName()); if (!newDirectory.mkdir()) { throw new IOException("Unable to create directory - " + newDirectory.getAbsolutePath()); } continue; } int size; byte[] buffer = new byte[2048]; FileOutputStream extractedSchemaFile = new FileOutputStream( new File(basePath, entry.getName())); BufferedOutputStream extractingBufferedStream = new BufferedOutputStream(extractedSchemaFile, buffer.length); try { while ((size = zipFileStream.read(buffer, 0, buffer.length)) != -1) { extractingBufferedStream.write(buffer, 0, size); } } finally { IdentityIOStreamUtils.flushOutputStream(extractingBufferedStream); IdentityIOStreamUtils.closeOutputStream(extractingBufferedStream); } } } catch (IOException e) { String msg = "Unable to extract schema directory to location " + this.schemaDirectory.getAbsolutePath() + " from " + this.zipSchemaStore.getAbsolutePath(); logger.error(msg, e); throw new IOException(msg, e); } finally{ IdentityIOStreamUtils.closeInputStream(zipFileStream); } if (logger.isDebugEnabled()) { logger.debug("Successfully extracted schema files to path " + this.schemaDirectory.getAbsolutePath() + " using schema zip file " + this.zipSchemaStore.getAbsolutePath()); } }