From: GiWoong Kim Date: Wed, 11 Nov 2015 11:09:45 +0000 (+0900) Subject: XML: print specified error cases while parsing X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~167 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3366d54204749fc7f9330a444ad068d9adb10570;p=sdk%2Femulator%2Fqemu.git XML: print specified error cases while parsing - UnexpectedElementError - NotWellFormedError - PrematureEndOfDocumentError Change-Id: Iaf80dfb40cc0167636fa190172991ef10a4f8f9a Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/ui/qt5_supplement.cpp b/tizen/src/ui/qt5_supplement.cpp index 2b33ba515c..ed39643b24 100644 --- a/tizen/src/ui/qt5_supplement.cpp +++ b/tizen/src/ui/qt5_supplement.cpp @@ -453,13 +453,18 @@ void qMessageOutput(QtMsgType type, const QMessageLogContext &context, const QSt fprintf(stderr, "%s|%5d|S|%10.10s|%4u|%s\n", dateMsg.constData(), qemu_get_thread_id(), fname.trimmed().constData(), context.line, localMsg.trimmed().constData()); + { + QString err; + QMessageBox::critical(0, EMULATOR_TITLE, + QString(MSG_INTERNAL_ERR) + + err.sprintf("%s", (localMsg.trimmed()).constData()) + + MSG_EMULATOR_EXIT); + } - QString err; - QMessageBox::critical(0, EMULATOR_TITLE, - QString(MSG_INTERNAL_ERR) + - err.sprintf("%s", (localMsg.trimmed()).constData()) + - MSG_EMULATOR_EXIT); abort(); + default: + qFatal("invalid message type"); + break; } } diff --git a/tizen/src/ui/xmllayoutparser.cpp b/tizen/src/ui/xmllayoutparser.cpp index a7c841909e..2b016ecacb 100644 --- a/tizen/src/ui/xmllayoutparser.cpp +++ b/tizen/src/ui/xmllayoutparser.cpp @@ -555,6 +555,10 @@ QString XmlLayoutParser::parseEmulatorUI(QXmlStreamReader &xml) } } + if (xml.hasError() == true) { + printError(xml.error()); + } + return layoutVersion; } @@ -652,6 +656,10 @@ QString XmlLayoutParser::parseControllerUI(QXmlStreamReader &xml) } } + if (xml.hasError() == true) { + printError(xml.error()); + } + return layoutVersion; } @@ -679,3 +687,27 @@ void XmlLayoutParser::makeGeneralCon(ControllerForm *form) form->setCenteralRect(painter.getCenteralRect()); form->setGeneralPurpose(true); } + +void XmlLayoutParser::printError(QXmlStreamReader::Error err) +{ + switch (err) { + case QXmlStreamReader::NoError: + /* do nothing */ + break; + case QXmlStreamReader::UnexpectedElementError: + qCritical("The parser encountered an element that was different to those it expected."); + break; + case QXmlStreamReader::CustomError: + qCritical("A custom error has been raised with raiseError()"); + break; + case QXmlStreamReader::NotWellFormedError: + qCritical("The parser internally raised an error due to the read XML not being well-formed."); + break; + case QXmlStreamReader::PrematureEndOfDocumentError: + qCritical("The input stream ended before a well-formed XML document was parsed."); + break; + default: + qFatal("invalid error type"); + break; + } +} diff --git a/tizen/src/ui/xmllayoutparser.h b/tizen/src/ui/xmllayoutparser.h index de643d10cd..1a8840a755 100644 --- a/tizen/src/ui/xmllayoutparser.h +++ b/tizen/src/ui/xmllayoutparser.h @@ -70,6 +70,8 @@ private: ControllerForm *parseControllerForm(QXmlStreamReader &xml); void makeGeneralCon(ControllerForm *form); + void printError(QXmlStreamReader::Error err); + QString xmlPath; UiInformation *uiInfo; };