=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java 2014-07-18 11:19:25 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java 2014-07-18 11:32:11 +0000 @@ -119,35 +119,33 @@ return FAILURE; } - ZipFile zip = new ZipFile( file ); - ZipEntry entry = zip.getEntry( "manifest.webapp" ); - - if ( entry == null) - { - zip.close(); - message = i18n.getString( "appmanager_manifest_not_found" ); - log.warn( "Manifest file could not be found in app" ); - return FAILURE; - } - - try - { - appManager.installApp( file, fileName, getRootPath() ); + try ( ZipFile zip = new ZipFile( file ) ) + { + ZipEntry entry = zip.getEntry( "manifest.webapp" ); + + if ( entry == null) + { + zip.close(); + message = i18n.getString( "appmanager_manifest_not_found" ); + log.warn( "Manifest file could not be found in app" ); + return FAILURE; + } - message = i18n.getString( "appmanager_install_success" ); - } - catch ( JsonParseException ex ) - { - message = i18n.getString( "appmanager_invalid_json" ); - log.error( "Error parsing JSON in manifest", ex ); - return FAILURE; - } - finally - { - zip.close(); - } - - return SUCCESS; + try + { + appManager.installApp( file, fileName, getRootPath() ); + + message = i18n.getString( "appmanager_install_success" ); + + return SUCCESS; + } + catch ( JsonParseException ex ) + { + message = i18n.getString( "appmanager_invalid_json" ); + log.error( "Error parsing JSON in manifest", ex ); + return FAILURE; + } + } } private String getRootPath()