diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2014-11-28 11:15:37 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2014-11-28 12:01:41 +0100 |
commit | 6595c0a9d1a140d3d647188efe5c1b1f78182ec7 (patch) | |
tree | 07bdc65ec0135ac6d4869ca1b3e1959c2db2c31e /src | |
parent | ee45dc6db502545676121ee100cfb3041fc4de83 (diff) | |
download | qt-creator-6595c0a9d1a140d3d647188efe5c1b1f78182ec7.tar.gz |
Catch exceptions by const reference.
Change-Id: Ic537fd123478a4f8fe4e54736d444fa64fd62d9c
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src')
30 files changed, 99 insertions, 99 deletions
diff --git a/src/libs/ssh/sftpincomingpacket.cpp b/src/libs/ssh/sftpincomingpacket.cpp index cea7306851..5fd38d473e 100644 --- a/src/libs/ssh/sftpincomingpacket.cpp +++ b/src/libs/ssh/sftpincomingpacket.cpp @@ -88,7 +88,7 @@ quint32 SftpIncomingPacket::extractServerVersion() const Q_ASSERT(type() == SSH_FXP_VERSION); try { return SshPacketParser::asUint32(m_data, TypeOffset + 1); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_FXP_VERSION packet."); } @@ -104,7 +104,7 @@ SftpHandleResponse SftpIncomingPacket::asHandleResponse() const response.requestId = SshPacketParser::asUint32(m_data, &offset); response.handle = SshPacketParser::asString(m_data, &offset); return response; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_FXP_HANDLE packet"); } @@ -122,7 +122,7 @@ SftpStatusResponse SftpIncomingPacket::asStatusResponse() const response.errorString = SshPacketParser::asUserString(m_data, &offset); response.language = SshPacketParser::asString(m_data, &offset); return response; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_FXP_STATUS packet."); } @@ -140,7 +140,7 @@ SftpNameResponse SftpIncomingPacket::asNameResponse() const for (quint32 i = 0; i < count; ++i) response.files << asFile(offset); return response; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_FXP_NAME packet."); } @@ -156,7 +156,7 @@ SftpDataResponse SftpIncomingPacket::asDataResponse() const response.requestId = SshPacketParser::asUint32(m_data, &offset); response.data = SshPacketParser::asString(m_data, &offset); return response; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_FXP_DATA packet."); } @@ -172,7 +172,7 @@ SftpAttrsResponse SftpIncomingPacket::asAttrsResponse() const response.requestId = SshPacketParser::asUint32(m_data, &offset); response.attrs = asFileAttributes(offset); return response; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_FXP_ATTRS packet."); } diff --git a/src/libs/ssh/sshchannel.cpp b/src/libs/ssh/sshchannel.cpp index 453812b928..35a6c51ed8 100644 --- a/src/libs/ssh/sshchannel.cpp +++ b/src/libs/ssh/sshchannel.cpp @@ -79,7 +79,7 @@ void AbstractSshChannel::requestSessionStart() m_sendFacility.sendSessionPacket(m_localChannel, initialWindowSize(), maxPacketSize()); setChannelState(SessionRequested); m_timeoutTimer.start(ReplyTimeout); - } catch (Botan::Exception &e) { + } catch (const Botan::Exception &e) { qDebug("Botan error: %s", e.what()); closeChannel(); } @@ -90,7 +90,7 @@ void AbstractSshChannel::sendData(const QByteArray &data) try { m_sendBuffer += data; flushSendBuffer(); - } catch (Botan::Exception &e) { + } catch (const Botan::Exception &e) { qDebug("Botan error: %s", e.what()); closeChannel(); } diff --git a/src/libs/ssh/sshchannelmanager.cpp b/src/libs/ssh/sshchannelmanager.cpp index dfead5b776..73dd559907 100644 --- a/src/libs/ssh/sshchannelmanager.cpp +++ b/src/libs/ssh/sshchannelmanager.cpp @@ -68,7 +68,7 @@ void SshChannelManager::handleChannelOpenFailure(const SshIncomingPacket &packet ChannelIterator it = lookupChannelAsIterator(failure.localChannel); try { it.value()->handleOpenFailure(failure.reasonString); - } catch (SshServerException &e) { + } catch (const SshServerException &e) { removeChannel(it); throw e; } diff --git a/src/libs/ssh/sshconnection.cpp b/src/libs/ssh/sshconnection.cpp index f79a047603..fd4e028ef1 100644 --- a/src/libs/ssh/sshconnection.cpp +++ b/src/libs/ssh/sshconnection.cpp @@ -329,13 +329,13 @@ void SshConnectionPrivate::handleIncomingData() if (m_serverId.isEmpty()) handleServerId(); handlePackets(); - } catch (SshServerException &e) { + } catch (const SshServerException &e) { closeConnection(e.error, SshProtocolError, e.errorStringServer, tr("SSH Protocol error: %1").arg(e.errorStringUser)); - } catch (SshClientException &e) { + } catch (const SshClientException &e) { closeConnection(SSH_DISCONNECT_BY_APPLICATION, e.error, "", e.errorString); - } catch (Botan::Exception &e) { + } catch (const Botan::Exception &e) { closeConnection(SSH_DISCONNECT_BY_APPLICATION, SshInternalError, "", tr("Botan library exception: %1").arg(QString::fromLatin1(e.what()))); } @@ -784,7 +784,7 @@ void SshConnectionPrivate::closeConnection(SshErrorCode sshError, try { m_channelManager->closeAllChannels(SshChannelManager::CloseAllAndReset); m_sendFacility.sendDisconnectPacket(sshError, serverErrorString); - } catch (Botan::Exception &) {} // Nothing sensible to be done here. + } catch (const Botan::Exception &) {} // Nothing sensible to be done here. if (m_error != SshNoError) emit error(userError); if (m_state == ConnectionEstablished) diff --git a/src/libs/ssh/sshdirecttcpiptunnel.cpp b/src/libs/ssh/sshdirecttcpiptunnel.cpp index 981876b5b9..5901127c5b 100644 --- a/src/libs/ssh/sshdirecttcpiptunnel.cpp +++ b/src/libs/ssh/sshdirecttcpiptunnel.cpp @@ -161,7 +161,7 @@ void SshDirectTcpIpTunnel::initialize() d->m_connectionInfo.localPort); d->setChannelState(AbstractSshChannel::SessionRequested); d->m_timeoutTimer.start(d->ReplyTimeout); - } catch (Botan::Exception &e) { // Won't happen, but let's play it safe. + } catch (const Botan::Exception &e) { // Won't happen, but let's play it safe. qDebug("Botan error: %s", e.what()); d->closeChannel(); } diff --git a/src/libs/ssh/sshincomingpacket.cpp b/src/libs/ssh/sshincomingpacket.cpp index b9e8d03f76..7639d34331 100644 --- a/src/libs/ssh/sshincomingpacket.cpp +++ b/src/libs/ssh/sshincomingpacket.cpp @@ -161,7 +161,7 @@ SshKeyExchangeInit SshIncomingPacket::extractKeyExchangeInitData() const = SshPacketParser::asNameList(m_data, &offset); exchangeData.firstKexPacketFollows = SshPacketParser::asBool(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_KEY_EXCHANGE_FAILED, "Key exchange failed: Server sent invalid SSH_MSG_KEXINIT packet."); } @@ -200,7 +200,7 @@ SshKeyExchangeReply SshIncomingPacket::extractKeyExchangeReply(const QByteArray throw SshPacketParseException(); replyData.signatureBlob = SshPacketParser::asString(m_data, &offset); return replyData; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_KEY_EXCHANGE_FAILED, "Key exchange failed: " "Server sent invalid SSH_MSG_KEXDH_REPLY packet."); @@ -218,7 +218,7 @@ SshDisconnect SshIncomingPacket::extractDisconnect() const msg.reasonCode = SshPacketParser::asUint32(m_data, &offset); msg.description = SshPacketParser::asUserString(m_data, &offset); msg.language = SshPacketParser::asString(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_DISCONNECT."); } @@ -237,7 +237,7 @@ SshUserAuthBanner SshIncomingPacket::extractUserAuthBanner() const msg.message = SshPacketParser::asUserString(m_data, &offset); msg.language = SshPacketParser::asString(m_data, &offset); return msg; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_USERAUTH_BANNER."); } @@ -262,7 +262,7 @@ SshUserAuthInfoRequestPacket SshIncomingPacket::extractUserAuthInfoRequest() con msg.echos << SshPacketParser::asBool(m_data, &offset); } return msg; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_USERAUTH_INFO_REQUEST."); } @@ -280,7 +280,7 @@ SshDebug SshIncomingPacket::extractDebug() const msg.message = SshPacketParser::asUserString(m_data, &offset); msg.language = SshPacketParser::asString(m_data, &offset); return msg; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_DEBUG."); } @@ -296,7 +296,7 @@ SshUnimplemented SshIncomingPacket::extractUnimplemented() const quint32 offset = TypeOffset + 1; msg.invalidMsgSeqNr = SshPacketParser::asUint32(m_data, &offset); return msg; - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_UNIMPLEMENTED."); } @@ -314,7 +314,7 @@ SshChannelOpenFailure SshIncomingPacket::extractChannelOpenFailure() const openFailure.reasonCode = SshPacketParser::asUint32(m_data, &offset); openFailure.reasonString = QString::fromLocal8Bit(SshPacketParser::asString(m_data, &offset)); openFailure.language = SshPacketParser::asString(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Server sent invalid SSH_MSG_CHANNEL_OPEN_FAILURE packet."); } @@ -333,7 +333,7 @@ SshChannelOpenConfirmation SshIncomingPacket::extractChannelOpenConfirmation() c confirmation.remoteChannel = SshPacketParser::asUint32(m_data, &offset); confirmation.remoteWindowSize = SshPacketParser::asUint32(m_data, &offset); confirmation.remoteMaxPacketSize = SshPacketParser::asUint32(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Server sent invalid SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet."); } @@ -350,7 +350,7 @@ SshChannelWindowAdjust SshIncomingPacket::extractWindowAdjust() const quint32 offset = TypeOffset + 1; adjust.localChannel = SshPacketParser::asUint32(m_data, &offset); adjust.bytesToAdd = SshPacketParser::asUint32(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_CHANNEL_WINDOW_ADJUST packet."); } @@ -367,7 +367,7 @@ SshChannelData SshIncomingPacket::extractChannelData() const quint32 offset = TypeOffset + 1; data.localChannel = SshPacketParser::asUint32(m_data, &offset); data.data = SshPacketParser::asString(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_CHANNEL_DATA packet."); } @@ -385,7 +385,7 @@ SshChannelExtendedData SshIncomingPacket::extractChannelExtendedData() const data.localChannel = SshPacketParser::asUint32(m_data, &offset); data.type = SshPacketParser::asUint32(m_data, &offset); data.data = SshPacketParser::asString(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_CHANNEL_EXTENDED_DATA packet."); } @@ -407,7 +407,7 @@ SshChannelExitStatus SshIncomingPacket::extractChannelExitStatus() const if (SshPacketParser::asBool(m_data, &offset)) throw SshPacketParseException(); exitStatus.exitStatus = SshPacketParser::asUint32(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid exit-status packet."); } @@ -432,7 +432,7 @@ SshChannelExitSignal SshIncomingPacket::extractChannelExitSignal() const exitSignal.coreDumped = SshPacketParser::asBool(m_data, &offset); exitSignal.error = SshPacketParser::asUserString(m_data, &offset); exitSignal.language = SshPacketParser::asString(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid exit-signal packet."); } @@ -446,7 +446,7 @@ quint32 SshIncomingPacket::extractRecipientChannel() const try { quint32 offset = TypeOffset + 1; return SshPacketParser::asUint32(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Server sent invalid packet."); } @@ -461,7 +461,7 @@ QByteArray SshIncomingPacket::extractChannelRequestType() const quint32 offset = TypeOffset + 1; SshPacketParser::asUint32(m_data, &offset); return SshPacketParser::asString(m_data, &offset); - } catch (SshPacketParseException &) { + } catch (const SshPacketParseException &) { throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR, "Invalid SSH_MSG_CHANNEL_REQUEST packet."); } diff --git a/src/libs/ssh/sshkeygenerator.cpp b/src/libs/ssh/sshkeygenerator.cpp index e5cb689cb5..b389afa425 100644 --- a/src/libs/ssh/sshkeygenerator.cpp +++ b/src/libs/ssh/sshkeygenerator.cpp @@ -78,7 +78,7 @@ bool SshKeyGenerator::generateKeys(KeyType type, PrivateKeyFormat format, int ke generateOpenSslPublicKeyString(key); } return true; - } catch (Botan::Exception &e) { + } catch (const Botan::Exception &e) { m_error = tr("Error generating key: %1").arg(QString::fromLatin1(e.what())); return false; } diff --git a/src/libs/ssh/sshremoteprocess.cpp b/src/libs/ssh/sshremoteprocess.cpp index f6c9f2def2..08d80644db 100644 --- a/src/libs/ssh/sshremoteprocess.cpp +++ b/src/libs/ssh/sshremoteprocess.cpp @@ -210,7 +210,7 @@ void SshRemoteProcess::sendSignal(Signal signal) QSSH_ASSERT_AND_RETURN(signalString); d->m_sendFacility.sendChannelSignalPacket(d->remoteChannel(), signalString); } - } catch (Botan::Exception &e) { + } catch (const Botan::Exception &e) { setErrorString(QString::fromLatin1(e.what())); d->closeChannel(); } diff --git a/src/libs/utils/elfreader.cpp b/src/libs/utils/elfreader.cpp index 0199fbd7aa..80bcf78ca5 100644 --- a/src/libs/utils/elfreader.cpp +++ b/src/libs/utils/elfreader.cpp @@ -117,7 +117,7 @@ bool ElfMapper::map() // Try reading the data into memory instead. try { raw = file.readAll(); - } catch (std::bad_alloc &) { + } catch (const std::bad_alloc &) { return false; } start = raw.constData(); diff --git a/src/libs/utils/portlist.cpp b/src/libs/utils/portlist.cpp index e07d31b52e..69f1265a21 100644 --- a/src/libs/utils/portlist.cpp +++ b/src/libs/utils/portlist.cpp @@ -63,7 +63,7 @@ public: try { if (!atEnd()) parseElemList(); - } catch (ParseException &e) { + } catch (const ParseException &e) { qWarning("Malformed ports specification: %s", e.error); } return m_portList; diff --git a/src/plugins/ios/iosdevice.cpp b/src/plugins/ios/iosdevice.cpp index 59667f2d3b..a6d0629525 100644 --- a/src/plugins/ios/iosdevice.cpp +++ b/src/plugins/ios/iosdevice.cpp @@ -410,7 +410,7 @@ void deviceConnectedCallback(void *refCon, io_iterator_t iterator) kr = IOObjectRelease(usbDevice); } } - catch (std::exception &e) { + catch (const std::exception &e) { qCWarning(detectLog) << "Exception " << e.what() << " in iosdevice.cpp deviceConnectedCallback"; } catch (...) { @@ -449,7 +449,7 @@ void deviceDisconnectedCallback(void *refCon, io_iterator_t iterator) kr = IOObjectRelease(usbDevice); } } - catch (std::exception &e) { + catch (const std::exception &e) { qCWarning(detectLog) << "Exception " << e.what() << " in iosdevice.cpp deviceDisconnectedCallback"; } catch (...) { diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index afe077ea5c..9667c5f41c 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -186,7 +186,7 @@ void toFront(const SelectionContext &selectionState) maximumZ++; node.setVariantProperty("z", maximumZ); } - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -204,7 +204,7 @@ void toBack(const SelectionContext &selectionState) node.setVariantProperty("z", minimumZ); } - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -224,7 +224,7 @@ void raise(const SelectionContext &selectionState) node.setVariantProperty("z", z); } } - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -245,7 +245,7 @@ void lower(const SelectionContext &selectionState) node.setVariantProperty("z", z); } } - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -269,7 +269,7 @@ void setVisible(const SelectionContext &selectionState) try { selectionState.selectedModelNodes().first().variantProperty("visible").setValue(selectionState.toggled()); - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -282,7 +282,7 @@ void setFillWidth(const SelectionContext &selectionState) try { selectionState.firstSelectedModelNode().variantProperty("Layout.fillWidth").setValue(selectionState.toggled()); - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -295,7 +295,7 @@ void setFillHeight(const SelectionContext &selectionState) try { selectionState.firstSelectedModelNode().variantProperty("Layout.fillHeight").setValue(selectionState.toggled()); - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -311,7 +311,7 @@ void resetSize(const SelectionContext &selectionState) node.removeProperty("width"); node.removeProperty("height"); } - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -327,7 +327,7 @@ void resetPosition(const SelectionContext &selectionState) node.removeProperty("x"); node.removeProperty("y"); } - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } @@ -392,7 +392,7 @@ void anchorsFill(const SelectionContext &selectionState) } transaction.commit(); - } catch (RewritingException &e) { //better save then sorry + } catch (const RewritingException &e) { //better save then sorry e.showException(); } } diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp index bfb72ffc68..bf1e8292ad 100644 --- a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp @@ -366,7 +366,7 @@ void DragTool::commitTransaction() { try { m_rewriterTransaction.commit(); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { e.showException(); } } diff --git a/src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp b/src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp index ee110c98f8..a85bc2efc7 100644 --- a/src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp +++ b/src/plugins/qmldesigner/components/importmanager/importmanagerview.cpp @@ -250,7 +250,7 @@ void ImportManagerView::removeImport(const Import &import) if (model()) model()->changeImports(QList<Import>(), QList<Import>() << import); } - catch (RewritingException &e) { + catch (const RewritingException &e) { e.showException(); } } @@ -261,7 +261,7 @@ void ImportManagerView::addImport(const Import &import) if (model()) model()->changeImports(QList<Import>() << import, QList<Import>()); } - catch (RewritingException &e) { + catch (const RewritingException &e) { e.showException(); } } diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index f079945cfb..80b5928235 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -352,7 +352,7 @@ void DesignDocument::deleteSelected() QmlObjectNode(node).destroy(); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { e.showException(); } } @@ -515,7 +515,7 @@ void DesignDocument::paste() } view.setSelectedModelNodes(pastedNodeList); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { qWarning() << e.description(); //silent error } } else { @@ -553,7 +553,7 @@ void DesignDocument::paste() NodeMetaInfo::clearCache(); view.setSelectedModelNodes(QList<ModelNode>() << pastedNode); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { qWarning() << e.description(); //silent error } } diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 01a8b81d51..9bf0a41f19 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -330,7 +330,7 @@ void ItemLibraryWidget::setImportFilter(FilterChangeFlag flag) QApplication::restoreOverrideCursor(); block = false; m_filterFlag = flag; - } catch (RewritingException &) { + } catch (const RewritingException &) { QApplication::restoreOverrideCursor(); m_filterFlag = oldfilterFlag; block = false; diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index a5d96c2b10..720115f4db 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -634,7 +634,7 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty &parentProper } } } - } catch (RewritingException &exception) { //better safe than sorry! There always might be cases where we fail + } catch (const RewritingException &exception) { //better safe than sorry! There always might be cases where we fail exception.showException(); } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 46f82550c8..357aad06f1 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -215,7 +215,7 @@ void PropertyEditorView::changeValue(const QString &name) } } } - catch (RewritingException &e) { + catch (const RewritingException &e) { e.showException(); } } @@ -291,7 +291,7 @@ void PropertyEditorView::changeExpression(const QString &propertyName) transaction.commit(); //committing in the try block } - catch (RewritingException &e) { + catch (const RewritingException &e) { e.showException(); } } diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index f48a12439d..2cfc2b4e4d 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -158,7 +158,7 @@ void StatesEditorView::removeState(int nodeId) stateNode.destroy(); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { e.showException(); } } @@ -209,7 +209,7 @@ void StatesEditorView::addState() model()->changeImports(QList<Import>() << Import::createLibraryImport("QtQuick", "1.0"), QList<Import>()); ModelNode newState = rootStateGroup().addState(newStateName); setCurrentState(newState); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { e.showException(); } } @@ -304,7 +304,7 @@ void StatesEditorView::renameState(int internalNodeId, const QString &newName) state.setName(newName); setCurrentState(oldState); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { e.showException(); } } diff --git a/src/plugins/qmldesigner/designercore/include/rewriterview.h b/src/plugins/qmldesigner/designercore/include/rewriterview.h index 3b3064a9d8..f658cc1acd 100644 --- a/src/plugins/qmldesigner/designercore/include/rewriterview.h +++ b/src/plugins/qmldesigner/designercore/include/rewriterview.h @@ -84,7 +84,7 @@ public: Error(); Error(const QmlJS::DiagnosticMessage &qmlError, const QUrl &document); Error(const QString &shortDescription); - Error(Exception *exception); + Error(const Exception *exception); Type type() const { return m_type; } diff --git a/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp index 844a2c3a6d..7a1d4a6cb1 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/metainfo.cpp @@ -96,7 +96,7 @@ void MetaInfoPrivate::parseItemLibraryDescriptions() Internal::MetaInfoReader reader(*m_q); try { reader.readMetaInfoFile(plugin->metaInfo()); - } catch (InvalidMetaInfoException &e) { + } catch (const InvalidMetaInfoException &e) { qWarning() << e.description(); const QString errorMessage = plugin->metaInfo() + QLatin1Char('\n') + QLatin1Char('\n') + reader.errors().join(QLatin1Char('\n')); Core::AsynchronousMessageBox::warning(QCoreApplication::translate("QmlDesigner::Internal::MetaInfoPrivate", "Invalid meta info"), diff --git a/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp b/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp index be7f894f75..68d462de88 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp @@ -301,7 +301,7 @@ void MetaInfoReader::insertItemLibraryEntry() try { m_metaInfo.itemLibraryInfo()->addEntry(m_currentEntry, m_overwriteDuplicates); - } catch (InvalidMetaInfoException &) { + } catch (const InvalidMetaInfoException &) { addError(tr("Invalid or duplicate item library entry %1").arg(m_currentEntry.name()), currentSourceLocation()); } } diff --git a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp index ce6ca4dccd..3b94084c2c 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/subcomponentmanager.cpp @@ -235,7 +235,7 @@ void SubComponentManager::parseDirectory(const QString &canonicalDirPath, bool a reader.setQualifcation(qualification); try { reader.readMetaInfoFile(metaInfoFile.absoluteFilePath(), true); - } catch (InvalidMetaInfoException &e) { + } catch (const InvalidMetaInfoException &e) { qWarning() << e.description(); const QString errorMessage = metaInfoFile.absoluteFilePath() + QLatin1Char('\n') + QLatin1Char('\n') + reader.errors().join(QLatin1Char('\n')); Core::AsynchronousMessageBox::warning(QCoreApplication::translate("SubComponentManager::parseDirectory", "Invalid meta info"), diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index 3257623d55..a2cb19cdc3 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -157,7 +157,7 @@ void ModelPrivate::notifyImportsChanged(const QList<Import> &addedImports, const try { if (rewriterView()) rewriterView()->importsChanged(addedImports, removedImports); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -309,7 +309,7 @@ void ModelPrivate::changeNodeId(const InternalNode::Pointer& internalNodePointer try { notifyNodeIdChanged(internalNodePointer, id, oldId); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { throw InvalidIdException(__LINE__, __FUNCTION__, __FILE__, id, e.description()); } } @@ -337,7 +337,7 @@ void ModelPrivate::notifyAuxiliaryDataChanged(const InternalNodePointer &interna ModelNode node(internalNode, model(), rewriterView()); rewriterView()->auxiliaryDataChanged(node, name, data); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -368,7 +368,7 @@ void ModelPrivate::notifyNodeSourceChanged(const InternalNodePointer &internalNo ModelNode node(internalNode, model(), rewriterView()); rewriterView()->nodeSourceChanged(node, newNodeSource); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -397,7 +397,7 @@ void ModelPrivate::notifyRootNodeTypeChanged(const QString &type, int majorVersi try { if (rewriterView()) rewriterView()->rootNodeTypeChanged(type, majorVersion, minorVersion); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -443,7 +443,7 @@ void ModelPrivate::notifyInstancesCompleted(const QVector<ModelNode> &nodeVector try { if (rewriterView()) rewriterView()->instancesCompleted(toModelNodeVector(internalVector, rewriterView())); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -481,7 +481,7 @@ void ModelPrivate::notifyInstancesInformationsChange(const QMultiHash<ModelNode, try { if (rewriterView()) rewriterView()->instanceInformationsChange(convertModelNodeInformationHash(informationChangeHash, rewriterView())); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -508,7 +508,7 @@ void ModelPrivate::notifyInstancesRenderImageChanged(const QVector<ModelNode> &n try { if (rewriterView()) rewriterView()->instancesRenderImageChanged(toModelNodeVector(internalVector, rewriterView())); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -535,7 +535,7 @@ void ModelPrivate::notifyInstancesPreviewImageChanged(const QVector<ModelNode> & try { if (rewriterView()) rewriterView()->instancesPreviewImageChanged(toModelNodeVector(internalVector, rewriterView())); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -562,7 +562,7 @@ void ModelPrivate::notifyInstancesChildrenChanged(const QVector<ModelNode> &node try { if (rewriterView()) rewriterView()->instancesChildrenChanged(toModelNodeVector(internalVector, rewriterView())); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -589,7 +589,7 @@ void ModelPrivate::notifyCurrentStateChanged(const ModelNode &node) try { if (rewriterView()) rewriterView()->currentStateChanged(ModelNode(node.internalNode(), model(), rewriterView())); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -614,7 +614,7 @@ void ModelPrivate::notifyRewriterBeginTransaction() try { if (rewriterView()) rewriterView()->rewriterBeginTransaction(); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -639,7 +639,7 @@ void ModelPrivate::notifyRewriterEndTransaction() try { if (rewriterView()) rewriterView()->rewriterEndTransaction(); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -667,7 +667,7 @@ void ModelPrivate::notifyInstanceToken(const QString &token, int number, const Q try { if (rewriterView()) rewriterView()->instancesToken(token, number, toModelNodeVector(internalVector, rewriterView())); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -694,7 +694,7 @@ void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, cons try { if (rewriterView()) rewriterView()->customNotification(senderView, identifier, toModelNodeList(internalList, rewriterView()), data); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -727,7 +727,7 @@ void ModelPrivate::notifyPropertiesRemoved(const QList<PropertyPair> &propertyPa rewriterView()->propertiesRemoved(propertyList); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -772,7 +772,7 @@ void ModelPrivate::notifyPropertiesAboutToBeRemoved(const QList<InternalProperty rewriterView()->propertiesAboutToBeRemoved(propertyList); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -786,7 +786,7 @@ void ModelPrivate::notifyPropertiesAboutToBeRemoved(const QList<InternalProperty } try { view->propertiesAboutToBeRemoved(propertyList); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -856,7 +856,7 @@ void ModelPrivate::notifyNodeCreated(const InternalNode::Pointer &newInternalNod ModelNode createdNode(newInternalNodePointer, model(), rewriterView()); rewriterView()->nodeCreated(createdNode); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -886,7 +886,7 @@ void ModelPrivate::notifyNodeAboutToBeRemoved(const InternalNode::Pointer &inter ModelNode modelNode(internalNodePointer, model(), rewriterView()); rewriterView()->nodeAboutToBeRemoved(modelNode); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -920,7 +920,7 @@ void ModelPrivate::notifyNodeRemoved(const InternalNodePointer &internalNodePoin NodeAbstractProperty parentProperty(parentPropertyName, parentNodePointer, model(), rewriterView()); rewriterView()->nodeRemoved(modelNode, parentProperty, propertyChange); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -953,7 +953,7 @@ void ModelPrivate::notifyNodeIdChanged(const InternalNode::Pointer& internalNode ModelNode modelNode(internalNodePointer, model(), rewriterView()); rewriterView()->nodeIdChanged(modelNode, newId, oldId); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -987,7 +987,7 @@ void ModelPrivate::notifyBindingPropertiesChanged(const QList<InternalBindingPro } rewriterView()->bindingPropertiesChanged(propertyList, propertyChange); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -1028,7 +1028,7 @@ void ModelPrivate::notifySignalHandlerPropertiesChanged(const QVector<InternalSi } rewriterView()->signalHandlerPropertiesChanged(propertyList, propertyChange); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -1065,7 +1065,7 @@ void ModelPrivate::notifyScriptFunctionsChanged(const InternalNodePointer &inter ModelNode node(internalNodePointer, model(), rewriterView()); rewriterView()->scriptFunctionsChanged(node, scriptFunctionList); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -1106,7 +1106,7 @@ void ModelPrivate::notifyVariantPropertiesChanged(const InternalNodePointer &int ModelNode node(internalNodePointer, model(), rewriterView()); rewriterView()->variantPropertiesChanged(propertyList, propertyChange); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -1163,7 +1163,7 @@ void ModelPrivate::notifyNodeAboutToBeReparent(const InternalNodePointer &intern ModelNode modelNode(internalNodePointer, model(), rewriterView()); rewriterView()->nodeAboutToBeReparented(modelNode, newProperty, oldProperty, propertyChange); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -1224,7 +1224,7 @@ void ModelPrivate::notifyNodeReparent(const InternalNode::Pointer &internalNodeP ModelNode node(internalNodePointer, model(), rewriterView()); rewriterView()->nodeReparented(node, newProperty, oldProperty, propertyChange); } - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } @@ -1274,7 +1274,7 @@ void ModelPrivate::notifyNodeOrderChanged(const InternalNodeListPropertyPointer rewriterView()->nodeOrderChanged(NodeListProperty(internalListPropertyPointer, model(), rewriterView()), ModelNode(internalNodePointer, model(), rewriterView()), oldIndex); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { description = e.description(); resetModel = true; } diff --git a/src/plugins/qmldesigner/designercore/model/modelmerger.cpp b/src/plugins/qmldesigner/designercore/model/modelmerger.cpp index 0c15cfc741..310db88e27 100644 --- a/src/plugins/qmldesigner/designercore/model/modelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelmerger.cpp @@ -193,7 +193,7 @@ void ModelMerger::replaceModel(const ModelNode &modelNode) syncNodeProperties(rootNode, modelNode, idRenamingHash, view()); syncNodeListProperties(rootNode, modelNode, idRenamingHash, view()); m_view->changeRootNodeType(modelNode.type(), modelNode.majorVersion(), modelNode.minorVersion()); - } catch (RewritingException &e) { + } catch (const RewritingException &e) { qWarning() << e.description(); //silent error } } diff --git a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp index 00edacf488..527c1a55c0 100644 --- a/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp @@ -283,7 +283,7 @@ void ModelToTextMerger::applyChanges() textModifier->commitGroup(); textModifier->reactivateChangeSignals(); - } catch (Exception &e) { + } catch (const Exception &e) { m_rewriterView->enterErrorState(e.description()); qDeleteAll(m_rewriteActions); diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index f8b29b58fd..db2867f853 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -154,7 +154,7 @@ QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibrary Q_ASSERT(newQmlItemNode.isValid()); } - catch (RewritingException &e) { + catch (const RewritingException &e) { e.showException(); } diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp index f6e09e101d..b801e96751 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp @@ -56,7 +56,7 @@ RewriterView::Error::Error(): { } -RewriterView::Error::Error(Exception *exception): +RewriterView::Error::Error(const Exception *exception): m_type(InternalError), m_line(exception->line()), m_column(-1), @@ -521,7 +521,7 @@ void RewriterView::applyChanges() modelToTextMerger()->applyChanges(); if (!errors().isEmpty()) enterErrorState(errors().first().description()); - } catch (Exception &e) { + } catch (const Exception &e) { const QString content = textModifierContent(); qDebug() << "RewriterException:" << m_rewritingErrorMessage; qDebug() << "Content:" << content; diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index ed3fce75d0..d5e783519e 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -966,7 +966,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH setActive(false); return true; - } catch (Exception &e) { + } catch (const Exception &e) { RewriterView::Error error(&e); // Somehow, the error below gets eaten in upper levels, so printing the // exception info here for debugging purposes: diff --git a/src/plugins/texteditor/generichighlighter/manager.cpp b/src/plugins/texteditor/generichighlighter/manager.cpp index 2f0d241ced..e385c88041 100644 --- a/src/plugins/texteditor/generichighlighter/manager.cpp +++ b/src/plugins/texteditor/generichighlighter/manager.cpp @@ -175,7 +175,7 @@ QSharedPointer<HighlightDefinition> Manager::definition(const QString &id) m_isBuildingDefinition.insert(id); try { reader.parse(source); - } catch (HighlighterException &) { + } catch (const HighlighterException &) { definition.clear(); } m_isBuildingDefinition.remove(id); |