From db0fcb87fbfa0cce726f7ff8aa9792daef5b2719 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Thu, 13 Jan 2005 14:43:42 +0000 Subject: [PATCH] changed try-catch formatting added deletePreferencesItem() to authentication module --- .../AuthenticationClientInterface.h | 27 ++++++++- .../src/AuthenticationClientFactoryTest.cxx | 25 +++++++- .../src/TestAuthenticationClient.cxx | 41 ++++++++++--- .../src/TestAuthenticationClient.h | 29 ++++++--- .../src/TestAuthenticationClientTest.cxx | 25 +++++++- .../src/WebAuthenticationClient.cxx | 60 ++++++++++++++++++- .../src/WebAuthenticationClient.h | 24 +++++++- .../src/WebAuthenticationClientTest.cxx | 25 +++++++- livesupport/modules/core/src/AudioClip.cxx | 11 ++-- livesupport/modules/core/src/Md5.cxx | 5 +- livesupport/modules/core/src/Playlist.cxx | 30 ++++------ .../modules/core/src/PlaylistElement.cxx | 8 +-- .../modules/storage/src/TestStorageClient.cxx | 14 ++--- .../modules/storage/src/WebStorageClient.cxx | 14 ++--- 14 files changed, 261 insertions(+), 77 deletions(-) diff --git a/livesupport/modules/authentication/include/LiveSupport/Authentication/AuthenticationClientInterface.h b/livesupport/modules/authentication/include/LiveSupport/Authentication/AuthenticationClientInterface.h index 6355b1af8..7c277822c 100644 --- a/livesupport/modules/authentication/include/LiveSupport/Authentication/AuthenticationClientInterface.h +++ b/livesupport/modules/authentication/include/LiveSupport/Authentication/AuthenticationClientInterface.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/include/LiveSupport/Authentication/AuthenticationClientInterface.h,v $ ------------------------------------------------------------------------------*/ @@ -69,7 +69,7 @@ using namespace LiveSupport::Core; * An interface for authentication clients. * * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class AuthenticationClientInterface { @@ -162,6 +162,29 @@ class AuthenticationClientInterface Ptr::Ref value) throw (XmlRpcException) = 0; + + /** + * Delete a `user preferences' item from the server. + * + * @param sessionId the ID of the current session (from login()) + * @param key the name of the item + * + * @exception XmlRpcInvalidArgumentException + * bad sessionId argument + * @exception XmlRpcCommunicationException + * problem with performing XML-RPC call + * @exception XmlRpcMethodFaultException + * XML-RPC method returned fault response + * @exception XmlRpcMethodResponseException + * response from XML-RPC method is incorrect + * @exception XmlRpcException other error + * (TestAuthenticationClient only) + */ + virtual void + deletePreferencesItem(Ptr::Ref sessionId, + const Glib::ustring & key) + throw (XmlRpcException) + = 0; }; diff --git a/livesupport/modules/authentication/src/AuthenticationClientFactoryTest.cxx b/livesupport/modules/authentication/src/AuthenticationClientFactoryTest.cxx index 7903c9c72..f102b6982 100644 --- a/livesupport/modules/authentication/src/AuthenticationClientFactoryTest.cxx +++ b/livesupport/modules/authentication/src/AuthenticationClientFactoryTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/AuthenticationClientFactoryTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -199,7 +199,7 @@ AuthenticationClientFactoryTest :: preferencesTest(void) } CPPUNIT_ASSERT(*newPrefValue == "страстные"); - // check another normal save and load + // check another normal save and load... prefValue.reset(new const Glib::ustring("ne dobryj")); try { authentication->savePreferencesItem(sessionId, "hour", prefValue); @@ -207,6 +207,14 @@ AuthenticationClientFactoryTest :: preferencesTest(void) CPPUNIT_FAIL(e.what()); } + // ... but now change session ID in the middle + try { + authentication->logout(sessionId); + sessionId = authentication->login("root", "q"); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + try { newPrefValue = authentication->loadPreferencesItem(sessionId, "hour"); } catch (XmlRpcException &e) { @@ -214,6 +222,19 @@ AuthenticationClientFactoryTest :: preferencesTest(void) } CPPUNIT_ASSERT(*newPrefValue == *prefValue); + // check the delete method + try { + authentication->deletePreferencesItem(sessionId, "hour"); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + + try { + newPrefValue = authentication->loadPreferencesItem(sessionId, "hour"); + CPPUNIT_FAIL("Allowed to load preference after it was deleted"); + } catch (XmlRpcException &e) { + } + // and log out try { authentication->logout(sessionId); diff --git a/livesupport/modules/authentication/src/TestAuthenticationClient.cxx b/livesupport/modules/authentication/src/TestAuthenticationClient.cxx index b93ccc87f..757def912 100644 --- a/livesupport/modules/authentication/src/TestAuthenticationClient.cxx +++ b/livesupport/modules/authentication/src/TestAuthenticationClient.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.cxx,v $ ------------------------------------------------------------------------------*/ @@ -168,8 +168,7 @@ TestAuthenticationClient :: login(const std::string & login, sessionIdList.insert(sessionIdStream.str()); sessionId.reset(new SessionId(sessionIdStream.str())); return sessionId; - } - else { + } else { throw XmlRpcException("incorrect login or password"); } } @@ -185,8 +184,7 @@ TestAuthenticationClient :: logout(Ptr::Ref sessionId) // this returns the number of entries found and erased if (!sessionId || sessionIdList.erase(sessionId->getId())) { return; - } - else { + } else { throw XmlRpcException("logout() called without previous login()"); } } @@ -203,10 +201,10 @@ TestAuthenticationClient :: loadPreferencesItem( { if (!sessionId || sessionIdList.find(sessionId->getId()) == sessionIdList.end()) { - throw XmlRpcException("loadPreferences() called before login()"); + throw XmlRpcException("bad session ID"); } - preferencesType::iterator it; + PreferencesType::iterator it; if ((it = preferences.find(key)) == preferences.end()) { throw XmlRpcException("no such user preferences item"); @@ -227,6 +225,11 @@ TestAuthenticationClient :: savePreferencesItem( Ptr::Ref value) throw (XmlRpcException) { + if (!sessionId + || sessionIdList.find(sessionId->getId()) == sessionIdList.end()) { + throw XmlRpcException("bad session ID"); + } + if (sessionIdList.find(sessionId->getId()) == sessionIdList.end()) { throw XmlRpcException("loadPreferences() called before login()"); } @@ -234,3 +237,27 @@ TestAuthenticationClient :: savePreferencesItem( preferences[key] = value; } + +/*------------------------------------------------------------------------------ + * Delete a `user preferences' item from the server. + *----------------------------------------------------------------------------*/ +void +TestAuthenticationClient :: deletePreferencesItem( + Ptr::Ref sessionId, + const Glib::ustring & key) + throw (XmlRpcException) +{ + if (!sessionId + || sessionIdList.find(sessionId->getId()) == sessionIdList.end()) { + throw XmlRpcException("bad session ID"); + } + + PreferencesType::iterator it; + + if ((it = preferences.find(key)) == preferences.end()) { + throw XmlRpcException("no such user preferences item"); + } + + preferences.erase(it); +} + diff --git a/livesupport/modules/authentication/src/TestAuthenticationClient.h b/livesupport/modules/authentication/src/TestAuthenticationClient.h index b0be28a48..737dae7b7 100644 --- a/livesupport/modules/authentication/src/TestAuthenticationClient.h +++ b/livesupport/modules/authentication/src/TestAuthenticationClient.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.7 $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClient.h,v $ ------------------------------------------------------------------------------*/ @@ -65,7 +65,10 @@ using namespace LiveSupport::Core; /* =============================================================== data types */ /** - * A dummy authentication client. + * A dummy authentication client. It only supports one user, whose name and + * password are read from a configuration file. It issues session IDs when + * login() is called, and deletes these session IDs when logout() is called. + * It also stores (key, value) pairs of user preferences for this one user. * * This object has to be configured with an XML configuration element * called testAuthentication. This element contains a child element @@ -92,7 +95,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ class TestAuthenticationClient : virtual public Configurable, @@ -119,12 +122,12 @@ class TestAuthenticationClient : * A type for the list of sessionId's. */ typedef std::set - sessionIdListType; + SessionIdListType; /** * A list of the sessionId's we have issued. */ - sessionIdListType sessionIdList; + SessionIdListType sessionIdList; /** * The number of the sessionId's we have issued. @@ -135,12 +138,12 @@ class TestAuthenticationClient : * A type for the list of user preferences. */ typedef std::map::Ref> - preferencesType; + PreferencesType; /** * A list of the user preferences items stored. */ - preferencesType preferences; + PreferencesType preferences; public: @@ -228,6 +231,18 @@ class TestAuthenticationClient : const Glib::ustring & key, Ptr::Ref value) throw (XmlRpcException); + + /** + * Delete a `user preferences' item from the server. + * + * @param sessionId the ID of the current session (from login()) + * @param key the name of the item + * @exception XmlRpcException invalid session ID, or no such key + */ + virtual void + deletePreferencesItem(Ptr::Ref sessionId, + const Glib::ustring & key) + throw (XmlRpcException); }; diff --git a/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx b/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx index 1ab88aa35..18d8f8b95 100644 --- a/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx +++ b/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/TestAuthenticationClientTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -207,7 +207,7 @@ TestAuthenticationClientTest :: preferencesTest(void) } CPPUNIT_ASSERT(*newPrefValue == "страстные"); - // check another normal save and load + // check another normal save and load... prefValue.reset(new const Glib::ustring("ne dobryj")); try { tac->savePreferencesItem(sessionId, "hour", prefValue); @@ -215,6 +215,14 @@ TestAuthenticationClientTest :: preferencesTest(void) CPPUNIT_FAIL(e.what()); } + + // ... but now change session ID in the middle + try { + tac->logout(sessionId); + sessionId = tac->login("root", "q"); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } try { newPrefValue = tac->loadPreferencesItem(sessionId, "hour"); } catch (XmlRpcException &e) { @@ -222,6 +230,19 @@ TestAuthenticationClientTest :: preferencesTest(void) } CPPUNIT_ASSERT(*newPrefValue == *prefValue); + // check the delete method + try { + tac->deletePreferencesItem(sessionId, "hour"); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + + try { + newPrefValue = tac->loadPreferencesItem(sessionId, "hour"); + CPPUNIT_FAIL("Allowed to load preference after it was deleted"); + } catch (XmlRpcException &e) { + } + // and log out try { tac->logout(sessionId); diff --git a/livesupport/modules/authentication/src/WebAuthenticationClient.cxx b/livesupport/modules/authentication/src/WebAuthenticationClient.cxx index a109e5d95..7bf17b305 100644 --- a/livesupport/modules/authentication/src/WebAuthenticationClient.cxx +++ b/livesupport/modules/authentication/src/WebAuthenticationClient.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.7 $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.cxx,v $ ------------------------------------------------------------------------------*/ @@ -139,6 +139,11 @@ static const std::string loadPreferencesMethodName = "locstor.loadPref"; *----------------------------------------------------------------------------*/ static const std::string savePreferencesMethodName = "locstor.savePref"; +/*------------------------------------------------------------------------------ + * The name of the delete preferences method on the server + *----------------------------------------------------------------------------*/ +static const std::string deletePreferencesMethodName = "locstor.delPref"; + /*------------------------------------------------------------------------------ * The name of the session ID parameter in the input structure *----------------------------------------------------------------------------*/ @@ -450,6 +455,59 @@ WebAuthenticationClient :: savePreferencesItem( } +/*------------------------------------------------------------------------------ + * Delete a `user preferences' item from the server. + *----------------------------------------------------------------------------*/ +void +WebAuthenticationClient :: deletePreferencesItem( + Ptr::Ref sessionId, + const Glib::ustring & key) + throw (XmlRpcException) +{ + if (!sessionId) { + throw Core::XmlRpcInvalidArgumentException("Missing session ID."); + } + + XmlRpcValue parameters; + XmlRpcValue result; + + XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort, + storageServerPath.c_str(), false); + + parameters.clear(); + parameters[preferencesSessionIdParamName] = sessionId->getId(); + parameters[preferencesKeyParamName] = std::string(key); + + result.clear(); + if (!xmlRpcClient.execute(deletePreferencesMethodName.c_str(), + parameters, result)) { + throw Core::XmlRpcCommunicationException( + "Could not execute XML-RPC method."); + } + + if (xmlRpcClient.isFault()) { + std::stringstream eMsg; + eMsg << "XML-RPC method " + << deletePreferencesMethodName + << " returned fault response:\n" + << result; + throw Core::XmlRpcMethodFaultException(eMsg.str()); + } + + if (! result.hasMember(preferencesStatusParamName) + || result[preferencesStatusParamName].getType() + != XmlRpcValue::TypeBoolean + || ! bool(result[preferencesStatusParamName])) { + std::stringstream eMsg; + eMsg << "XML-RPC method " + << deletePreferencesMethodName + << " returned unexpected response:\n" + << result; + throw Core::XmlRpcMethodResponseException(eMsg.str()); + } +} + + /*------------------------------------------------------------------------------ * Reset the list of preferences to its initial (empty) state. *----------------------------------------------------------------------------*/ diff --git a/livesupport/modules/authentication/src/WebAuthenticationClient.h b/livesupport/modules/authentication/src/WebAuthenticationClient.h index f38da322a..e62e935bb 100644 --- a/livesupport/modules/authentication/src/WebAuthenticationClient.h +++ b/livesupport/modules/authentication/src/WebAuthenticationClient.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/authentication/src/WebAuthenticationClient.h,v $ ------------------------------------------------------------------------------*/ @@ -93,7 +93,7 @@ using namespace LiveSupport::Core; * * * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class WebAuthenticationClient : virtual public Configurable, @@ -236,6 +236,26 @@ class WebAuthenticationClient : Ptr::Ref value) throw (XmlRpcException); + /** + * Delete a `user preferences' item from the server. + * + * @param sessionId the ID of the current session (from login()) + * @param key the name of the item + * + * @exception XmlRpcInvalidArgumentException + * bad sessionId argument + * @exception XmlRpcCommunicationException + * problem with performing XML-RPC call + * @exception XmlRpcMethodFaultException + * XML-RPC method returned fault response + * @exception XmlRpcMethodResponseException + * response from XML-RPC method is incorrect + */ + virtual void + deletePreferencesItem(Ptr::Ref sessionId, + const Glib::ustring & key) + throw (XmlRpcException); + /** * Reset the list of preferences to its initial (empty) state. * diff --git a/livesupport/modules/authentication/src/WebAuthenticationClientTest.cxx b/livesupport/modules/authentication/src/WebAuthenticationClientTest.cxx index f90e51648..2a793654a 100644 --- a/livesupport/modules/authentication/src/WebAuthenticationClientTest.cxx +++ b/livesupport/modules/authentication/src/WebAuthenticationClientTest.cxx @@ -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/WebAuthenticationClientTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -212,7 +212,7 @@ WebAuthenticationClientTest :: preferencesTest(void) } CPPUNIT_ASSERT(*newPrefValue == "страстные"); - // check another normal save and load + // check another normal save and load ... prefValue.reset(new const Glib::ustring("ne dobryj")); try { wac->savePreferencesItem(sessionId, "hour", prefValue); @@ -220,6 +220,14 @@ WebAuthenticationClientTest :: preferencesTest(void) CPPUNIT_FAIL(e.what()); } + // ... but now change session ID in the middle + try { + wac->logout(sessionId); + sessionId = wac->login("root", "q"); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + try { newPrefValue = wac->loadPreferencesItem(sessionId, "hour"); } catch (XmlRpcException &e) { @@ -227,6 +235,19 @@ WebAuthenticationClientTest :: preferencesTest(void) } CPPUNIT_ASSERT(*newPrefValue == *prefValue); + // check the delete method + try { + wac->deletePreferencesItem(sessionId, "hour"); + } catch (XmlRpcException &e) { + CPPUNIT_FAIL(e.what()); + } + + try { + newPrefValue = wac->loadPreferencesItem(sessionId, "hour"); + CPPUNIT_FAIL("Allowed to load preference after it was deleted"); + } catch (XmlRpcException &e) { + } + // and log out try { wac->logout(sessionId); diff --git a/livesupport/modules/core/src/AudioClip.cxx b/livesupport/modules/core/src/AudioClip.cxx index 399064327..9f46f4ae2 100644 --- a/livesupport/modules/core/src/AudioClip.cxx +++ b/livesupport/modules/core/src/AudioClip.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.16 $ + Version : $Revision: 1.17 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $ ------------------------------------------------------------------------------*/ @@ -288,8 +288,7 @@ AudioClip :: configure(const xmlpp::Element & element) if (dataElement->has_child_text()) { playlength.reset(new time_duration(duration_from_string( dataElement->get_child_text()->get_content() ))); - } - else { // or just leave blank? bad either way + } else { // or just leave blank? bad either way playlength.reset(new time_duration(0,0,0,0)); } } @@ -299,8 +298,7 @@ AudioClip :: configure(const xmlpp::Element & element) Glib::ustring value; if (dataElement->has_child_text()) { value = dataElement->get_child_text()->get_content(); - } - else { + } else { value = ""; } Ptr::Ref ptrToValue( @@ -413,8 +411,7 @@ AudioClip :: setMetadata(Ptr::Ref value, xmlpp::Element* metadata; if (rootList.size() > 0) { metadata = dynamic_cast (rootList.front()); - } - else { + } else { metadata = rootNode->add_child("metadata"); metadata->set_namespace_declaration(defaultPrefixUri); metadata->set_namespace_declaration(titleElementUri, diff --git a/livesupport/modules/core/src/Md5.cxx b/livesupport/modules/core/src/Md5.cxx index 9c9c661fa..ab5322eb5 100644 --- a/livesupport/modules/core/src/Md5.cxx +++ b/livesupport/modules/core/src/Md5.cxx @@ -73,7 +73,7 @@ documentation and/or software. ------------------------------------------------------------------------------ Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Md5.cxx,v $ ------------------------------------------------------------------------------*/ @@ -198,8 +198,7 @@ void Md5::update (uint1 *input, uint4 input_length) transform (input+input_index); } buffer_index = 0; // so we can buffer remaining - } - else { + } else { input_index=0; // so we can buffer the whole input } diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx index 8120df133..8331455d2 100644 --- a/livesupport/modules/core/src/Playlist.cxx +++ b/livesupport/modules/core/src/Playlist.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.25 $ + Version : $Revision: 1.26 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $ ------------------------------------------------------------------------------*/ @@ -109,8 +109,7 @@ Playlist :: configure(const xmlpp::Element & element) if ((attribute = element.get_attribute(titleAttrName))) { title.reset(new const Glib::ustring(attribute->get_value())); - } - else { + } else { title.reset(new const Glib::ustring("")); } @@ -276,17 +275,14 @@ Playlist::setLockedForEditing(const bool lockStatus) if (lockStatus == true) { if (isLockedForPlaying || isLockedForEditing) { return false; - } - else { + } else { isLockedForEditing = true; return true; } - } - else { + } else { if (isLockedForPlaying) { return false; - } - else { + } else { isLockedForEditing = false; return true; // returns true also if playlist } // was already unlocked! @@ -304,13 +300,11 @@ Playlist::setLockedForPlaying(const bool lockStatus) if (lockStatus == true) { if (isLockedForPlaying) { return false; - } - else { + } else { isLockedForPlaying = true; // preserve LockedForEditing state return true; } - } - else { + } else { isLockedForPlaying = false; // restore LockedForEditing state; return true; // returns true also if playlist } // was already unlocked! @@ -337,15 +331,14 @@ Playlist::valid(void) throw () if (playlistElement->getType() == PlaylistElement::AudioClipType) { audioClip = playlistElement->getAudioClip(); *runningTime += *(audioClip->getPlaylength()); - } - else if (playlistElement->getType() == PlaylistElement::PlaylistType) { + } else if (playlistElement->getType() + == PlaylistElement::PlaylistType) { playlist = playlistElement->getPlaylist(); if (!playlist->valid()) { return false; } *runningTime += *(playlist->getPlaylength()); - } - else { // this should never happen + } else { // this should never happen return false; } ++it; @@ -409,8 +402,7 @@ Playlist :: getMetadata(const string &key, const string &ns) const if (it != metadata.end()) { Ptr::Ref data(new Glib::ustring(*it->second)); return data; - } - else { + } else { Ptr::Ref nullPointer; return nullPointer; } diff --git a/livesupport/modules/core/src/PlaylistElement.cxx b/livesupport/modules/core/src/PlaylistElement.cxx index 47a64c0e9..b5a3e93cf 100644 --- a/livesupport/modules/core/src/PlaylistElement.cxx +++ b/livesupport/modules/core/src/PlaylistElement.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.9 $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $ ------------------------------------------------------------------------------*/ @@ -135,8 +135,7 @@ PlaylistElement :: configure(const xmlpp::Element & element) eMsg += " XML element"; throw std::invalid_argument(eMsg); } - } - else { + } else { childNodes = element.get_children(playlistElementName); it = childNodes.begin(); if (it != childNodes.end()) { @@ -153,8 +152,7 @@ PlaylistElement :: configure(const xmlpp::Element & element) eMsg += " XML element"; throw std::invalid_argument(eMsg); } - } - else { + } else { std::string eMsg = "missing "; eMsg += audioClipElementName; eMsg += " or "; diff --git a/livesupport/modules/storage/src/TestStorageClient.cxx b/livesupport/modules/storage/src/TestStorageClient.cxx index 7dcd575ca..c9e1626ee 100644 --- a/livesupport/modules/storage/src/TestStorageClient.cxx +++ b/livesupport/modules/storage/src/TestStorageClient.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.28 $ + Version : $Revision: 1.29 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $ ------------------------------------------------------------------------------*/ @@ -371,8 +371,7 @@ TestStorageClient :: acquirePlaylist(Ptr::Ref sessionId, smilAudioClipUriAttrName, *(audioClip->getUri()) ); ++it; - } - else if (plElement->getType() == PlaylistElement::PlaylistType) { + } else if (plElement->getType() == PlaylistElement::PlaylistType) { Ptr::Ref playlist = acquirePlaylist(sessionId, plElement ->getPlaylist() @@ -387,8 +386,7 @@ TestStorageClient :: acquirePlaylist(Ptr::Ref sessionId, smilPlaylistUriAttrName, *(playlist->getUri()) ); ++it; - } - else { // this should never happen + } else { // this should never happen throw XmlRpcInvalidArgumentException( "unexpected playlist element type " "(neither audio clip nor playlist)"); @@ -442,8 +440,7 @@ TestStorageClient :: releasePlaylist(Ptr::Ref sessionId, eMsg += "\n"; } ++it; - } - else if (plElement->getType() == PlaylistElement::PlaylistType) { + } else if (plElement->getType() == PlaylistElement::PlaylistType) { try { releasePlaylist(sessionId, it->second->getPlaylist()); } @@ -452,8 +449,7 @@ TestStorageClient :: releasePlaylist(Ptr::Ref sessionId, eMsg += "\n"; } ++it; - } - else { // this should never happen + } else { // this should never happen eMsg += "unexpected playlist element type\n"; } } diff --git a/livesupport/modules/storage/src/WebStorageClient.cxx b/livesupport/modules/storage/src/WebStorageClient.cxx index 54c9c17eb..73507709a 100644 --- a/livesupport/modules/storage/src/WebStorageClient.cxx +++ b/livesupport/modules/storage/src/WebStorageClient.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.23 $ + Version : $Revision: 1.24 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $ ------------------------------------------------------------------------------*/ @@ -1016,8 +1016,7 @@ WebStorageClient :: acquirePlaylist(Ptr::Ref sessionId, smilAudioClipUriAttrName, *(audioClip->getUri()) ); ++it; - } - else if (plElement->getType() == PlaylistElement::PlaylistType) { + } else if (plElement->getType() == PlaylistElement::PlaylistType) { Ptr::Ref playlist = acquirePlaylist(sessionId, plElement ->getPlaylist() @@ -1032,8 +1031,7 @@ WebStorageClient :: acquirePlaylist(Ptr::Ref sessionId, smilPlaylistUriAttrName, *(playlist->getUri()) ); ++it; - } - else { // this should never happen + } else { // this should never happen throw XmlRpcInvalidArgumentException( "unexpected playlist element type " "(neither audio clip nor playlist)"); @@ -1086,8 +1084,7 @@ WebStorageClient :: releasePlaylist(Ptr::Ref sessionId, eMsg += "\n"; } ++it; - } - else if (plElement->getType() == PlaylistElement::PlaylistType) { + } else if (plElement->getType() == PlaylistElement::PlaylistType) { try { releasePlaylist(sessionId, it->second->getPlaylist()); } @@ -1096,8 +1093,7 @@ WebStorageClient :: releasePlaylist(Ptr::Ref sessionId, eMsg += "\n"; } ++it; - } - else { // this should never happen + } else { // this should never happen eMsg += "unexpected playlist element type\n"; } }