added a call to close() after every use of XmlRpcClient

This commit is contained in:
fgerlits 2005-01-13 16:54:55 +00:00
parent 696bec9e34
commit bb3b36e45a
15 changed files with 97 additions and 36 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.cxx,v $
------------------------------------------------------------------------------*/
@ -268,8 +268,10 @@ WebAuthenticationClient :: login(const std::string & login,
result.clear();
if (!xmlRpcClient.execute(loginMethodName.c_str(), parameters, result)) {
xmlRpcClient.close();
throw Authentication::XmlRpcCommunicationException("Login failed.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -319,8 +321,10 @@ WebAuthenticationClient :: logout(Ptr<SessionId>::Ref sessionId)
result.clear();
if (!xmlRpcClient.execute(logoutMethodName.c_str(), parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException("Logout failed.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -366,9 +370,11 @@ WebAuthenticationClient :: loadPreferencesItem(
result.clear();
if (!xmlRpcClient.execute(loadPreferencesMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException(
"Could not execute XML-RPC method.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -428,9 +434,11 @@ WebAuthenticationClient :: savePreferencesItem(
result.clear();
if (!xmlRpcClient.execute(savePreferencesMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException(
"Could not execute XML-RPC method.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -481,9 +489,11 @@ WebAuthenticationClient :: deletePreferencesItem(
result.clear();
if (!xmlRpcClient.execute(deletePreferencesMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException(
"Could not execute XML-RPC method.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -527,11 +537,11 @@ WebAuthenticationClient :: reset(void)
result.clear();
if (!xmlRpcClient.execute(resetStorageMethodName.c_str(),
parameters, result)) {
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += resetStorageMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
xmlRpcClient.close();
throw Core::XmlRpcCommunicationException(
"Could not execute XML-RPC method.");
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -539,7 +549,7 @@ WebAuthenticationClient :: reset(void)
<< resetStorageMethodName
<< "' returned error message:\n"
<< result;
throw XmlRpcMethodFaultException(eMsg.str());
throw Core::XmlRpcMethodFaultException(eMsg.str());
}
if (! result.hasMember(resetStorageResultParamName)
@ -550,7 +560,7 @@ WebAuthenticationClient :: reset(void)
<< resetStorageMethodName
<< "' returned unexpected value:\n"
<< result;
throw XmlRpcMethodResponseException(eMsg.str());
throw Core::XmlRpcMethodResponseException(eMsg.str());
}
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.24 $
Version : $Revision: 1.25 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
------------------------------------------------------------------------------*/
@ -317,20 +317,6 @@ static const std::string savePlaylistNewPlaylistParamName = "newPlaylist";
static const std::string savePlaylistResultParamName = "status";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: acquirePlaylist */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: releasePlaylist */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: deletePlaylist */
/*------------------------------------------------------------------------------
@ -667,11 +653,13 @@ WebStorageClient :: existsPlaylist(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(existsPlaylistMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += existsPlaylistMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -720,6 +708,7 @@ WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(getPlaylistOpenMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getPlaylistOpenMethodName;
eMsg += "'";
@ -777,12 +766,14 @@ WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(getPlaylistCloseMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getPlaylistCloseMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
@ -866,11 +857,13 @@ WebStorageClient :: editPlaylistGetUrl(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(editPlaylistMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += editPlaylistMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -929,11 +922,13 @@ WebStorageClient :: savePlaylist(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(savePlaylistMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += savePlaylistMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1131,11 +1126,13 @@ WebStorageClient :: deletePlaylist(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(deletePlaylistMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += deletePlaylistMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1200,11 +1197,13 @@ WebStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId)
result.clear();
if (!xmlRpcClient.execute(createPlaylistMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += createPlaylistMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1271,11 +1270,13 @@ WebStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(existsAudioClipMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += existsAudioClipMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1324,6 +1325,7 @@ WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(getAudioClipOpenMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getAudioClipOpenMethodName;
eMsg += "'";
@ -1383,11 +1385,13 @@ WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(getAudioClipCloseMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += getAudioClipCloseMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1462,6 +1466,7 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(storeAudioClipOpenMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += storeAudioClipOpenMethodName;
eMsg += "'";
@ -1538,11 +1543,13 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(storeAudioClipCloseMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += storeAudioClipCloseMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1601,11 +1608,13 @@ WebStorageClient :: acquireAudioClip(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(acquireAudioClipMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += acquireAudioClipMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1665,11 +1674,13 @@ WebStorageClient :: releaseAudioClip(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(releaseAudioClipMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += releaseAudioClipMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1728,11 +1739,13 @@ WebStorageClient :: deleteAudioClip(Ptr<SessionId>::Ref sessionId,
result.clear();
if (!xmlRpcClient.execute(deleteAudioClipMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += deleteAudioClipMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;
@ -1797,11 +1810,13 @@ WebStorageClient :: reset(void)
result.clear();
if (!xmlRpcClient.execute(resetStorageMethodName.c_str(),
parameters, result)) {
xmlRpcClient.close();
std::string eMsg = "cannot execute XML-RPC method '";
eMsg += resetStorageMethodName;
eMsg += "'";
throw XmlRpcCommunicationException(eMsg);
}
xmlRpcClient.close();
if (xmlRpcClient.isFault()) {
std::stringstream eMsg;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@ -217,4 +217,6 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void)
result.clear();
xmlRpcClient.execute("addAudioClipToPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
// xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcCreatePlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@ -210,4 +210,6 @@ RpcCreatePlaylistTest :: firstTest(void)
CPPUNIT_ASSERT(xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("faultCode"));
CPPUNIT_ASSERT(int(result["faultCode"]) == 105);
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/RpcDeletePlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@ -212,6 +212,8 @@ RpcDeletePlaylistTest :: firstTest(void)
result.clear();
xmlRpcClient.execute("deletePlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
xmlRpcClient.close();
}
@ -234,5 +236,7 @@ RpcDeletePlaylistTest :: negativeTest(void)
CPPUNIT_ASSERT(xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("faultCode"));
CPPUNIT_ASSERT(int(result["faultCode"]) == 903); // playlist not found
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipTest.cxx,v $
------------------------------------------------------------------------------*/
@ -182,6 +182,8 @@ DisplayAudioClipMethodTest :: firstTest(void)
CPPUNIT_ASSERT(result.hasMember("playlength"));
CPPUNIT_ASSERT(result["playlength"].getType() == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(result["playlength"]) == 60 * 60);
xmlRpcClient.close();
}
@ -204,4 +206,6 @@ DisplayAudioClipMethodTest :: negativeTest(void)
CPPUNIT_ASSERT(xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.hasMember("faultCode"));
CPPUNIT_ASSERT(int(result["faultCode"]) == 603); // audio clip not found
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayAudioClipsTest.cxx,v $
------------------------------------------------------------------------------*/
@ -188,5 +188,7 @@ DisplayAudioClipsMethodTest :: firstTest(void)
CPPUNIT_ASSERT(audioClip.hasMember("playlength"));
CPPUNIT_ASSERT(audioClip["playlength"].getType() == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 30 * 60);
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.7 $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@ -198,6 +198,8 @@ RpcDisplayPlaylistTest :: simpleTest(void)
CPPUNIT_ASSERT(std::string(result["id"]) == "0000000000000001");
CPPUNIT_ASSERT(int(result["playlength"]) == 90 * 60);
xmlRpcClient.close();
}
@ -219,4 +221,6 @@ RpcDisplayPlaylistTest :: negativeTest(void)
result.clear();
xmlRpcClient.execute("displayPlaylist", parameters, result);
CPPUNIT_ASSERT(xmlRpcClient.isFault());
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayPlaylistsTest.cxx,v $
------------------------------------------------------------------------------*/
@ -183,4 +183,6 @@ DisplayPlaylistsMethodTest :: firstTest(void)
CPPUNIT_ASSERT(playlist.hasMember("playlength"));
CPPUNIT_ASSERT(playlist["playlength"].getType() == XmlRpcValue::TypeInt);
CPPUNIT_ASSERT(int(playlist["playlength"]) == 90 * 60);
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcDisplayScheduleTest.cxx,v $
------------------------------------------------------------------------------*/
@ -197,5 +197,7 @@ RpcDisplayScheduleTest :: simpleTest(void)
xmlRpcClient.execute("displaySchedule", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
CPPUNIT_ASSERT(result.size() == 0);
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetSchedulerTimeTest.cxx,v $
------------------------------------------------------------------------------*/
@ -160,5 +160,7 @@ RpcGetSchedulerTimeTest :: simpleTest(void)
CPPUNIT_ASSERT(time1.tm_hour <= time2.tm_hour);
CPPUNIT_ASSERT(time1.tm_min <= time2.tm_min);
CPPUNIT_ASSERT(time1.tm_min + 1 >= time2.tm_min);
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcGetVersionTest.cxx,v $
------------------------------------------------------------------------------*/
@ -152,5 +152,7 @@ RpcGetVersionTest :: simpleTest(void)
CPPUNIT_ASSERT(result.hasMember("version"));
std::string versionStr = result["version"];
CPPUNIT_ASSERT(versionStr.find(versionPrefix) == 0);
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRemoveFromScheduleTest.cxx,v $
------------------------------------------------------------------------------*/
@ -199,6 +199,8 @@ RpcRemoveFromScheduleTest :: simpleTest(void)
result.clear();
xmlRpcClient.execute("removeFromSchedule", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
xmlRpcClient.close();
}
@ -220,5 +222,7 @@ RpcRemoveFromScheduleTest :: negativeTest(void)
result.clear();
xmlRpcClient.execute("removeFromSchedule", parameters, result);
CPPUNIT_ASSERT(xmlRpcClient.isFault());
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcRescheduleTest.cxx,v $
------------------------------------------------------------------------------*/
@ -223,6 +223,8 @@ RpcRescheduleTest :: simpleTest(void)
result.clear();
xmlRpcClient.execute("reschedule", parameters, result);
CPPUNIT_ASSERT(xmlRpcClient.isFault());
xmlRpcClient.close();
}
@ -244,5 +246,7 @@ RpcRescheduleTest :: negativeTest(void)
result.clear();
xmlRpcClient.execute("removeFromSchedule", parameters, result);
CPPUNIT_ASSERT(xmlRpcClient.isFault());
xmlRpcClient.close();
}

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.6 $
Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcUploadPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@ -191,5 +191,7 @@ RpcUploadPlaylistTest :: simpleTest(void)
result.clear();
xmlRpcClient.execute("uploadPlaylist", parameters, result);
CPPUNIT_ASSERT(!xmlRpcClient.isFault());
xmlRpcClient.close();
}