From f71331a8c91a31f4cb7efe17b235b71ab7aae26b Mon Sep 17 00:00:00 2001 From: Marcin Kaminski Date: Fri, 14 Dec 2012 14:41:25 +0100 Subject: [PATCH] [NABI][TWEB-678] Fix for unhandled exception [Issue#] TWEB-678 (NABI) [Bug] Unhandled exception while installing broken package [Cause] Lack of Exception catching [Solution] Proper catch and throw added [Verication] Build package. Try to install z4.html file from: https://tizendev.org/bugs/browse/TWEB-678 (it is widget package - not .html page) Change-Id: I0dceed2db098bf6bbbd9af554ca79e6343f78b6f --- src/jobs/widget_install/job_widget_install.cpp | 10 ++++++++++ src/jobs/widget_install/task_unzip.cpp | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index 70ce1c0..2006f9c 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -617,6 +617,11 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML( LogError("Failed to parse config.xml file"); return ConfigParserData(); } + Catch(DPL::ZipInput::Exception::SeekFileFailed) + { + LogError("Failed to seek widget archive - corrupted package?"); + return ConfigParserData(); + } return configInfo; } @@ -840,6 +845,11 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType( LogDebug("Failed to open widget package"); return PKG_TYPE_UNKNOWN; } + Catch(DPL::ZipInput::Exception::SeekFileFailed) + { + LogError("Failed to seek widget package file"); + return PKG_TYPE_UNKNOWN; + } Try { diff --git a/src/jobs/widget_install/task_unzip.cpp b/src/jobs/widget_install/task_unzip.cpp index b19bc19..fb084f6 100644 --- a/src/jobs/widget_install/task_unzip.cpp +++ b/src/jobs/widget_install/task_unzip.cpp @@ -116,6 +116,10 @@ void TaskUnzip::StepUnzipPrepare() { ReThrowMsg(Exceptions::OpenZipFailed, m_installerContext.locations->getWidgetSource()); } + Catch(DPL::ZipInput::Exception::SeekFileFailed) + { + ThrowMsg(Exceptions::ExtractFileFailed,"m_installerContext.locations->getWidgetSource()"); + } } void TaskUnzip::StepUnzipProgress() -- 2.7.4