This commit is contained in:
fgerlits 2006-11-28 19:23:12 +00:00
parent 0059d67a54
commit 115bce9de2
2 changed files with 45 additions and 27 deletions

View File

@ -1302,11 +1302,13 @@ WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
playlist->configure(*root); playlist->configure(*root);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
throw XmlRpcInvalidDataException( std::string eMsg = "semantic error in playlist metafile: ";
"semantic error in playlist metafile"); eMsg += e.what();
throw XmlRpcInvalidDataException(eMsg);
} catch (xmlpp::exception &e) { } catch (xmlpp::exception &e) {
throw XmlRpcInvalidDataException( std::string eMsg = "error parsing playlist metafile: ";
"error parsing playlist metafile"); eMsg += e.what();
throw XmlRpcInvalidDataException(eMsg);
} }
playlist->setToken(token); playlist->setToken(token);
@ -1344,11 +1346,13 @@ WebStorageClient :: editPlaylist(Ptr<SessionId>::Ref sessionId,
playlist->configure(*root); playlist->configure(*root);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
throw XmlRpcMethodResponseException( std::string eMsg = "semantic error in playlist metafile: ";
"semantic error in playlist metafile"); eMsg += e.what();
throw XmlRpcInvalidDataException(eMsg);
} catch (xmlpp::exception &e) { } catch (xmlpp::exception &e) {
throw XmlRpcMethodResponseException( std::string eMsg = "error parsing playlist metafile: ";
"error parsing playlist metafile"); eMsg += e.what();
throw XmlRpcInvalidDataException(eMsg);
} }
playlist->setEditToken(editToken); playlist->setEditToken(editToken);
@ -1541,11 +1545,13 @@ WebStorageClient :: acquirePlaylist(Ptr<const UniqueId>::Ref id,
playlist->configure(*root); playlist->configure(*root);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
throw XmlRpcInvalidDataException( std::string eMsg = "semantic error in playlist metafile: ";
"semantic error in playlist metafile"); eMsg += e.what();
throw XmlRpcInvalidDataException(eMsg);
} catch (xmlpp::exception &e) { } catch (xmlpp::exception &e) {
throw XmlRpcInvalidDataException( std::string eMsg = "error parsing playlist metafile: ";
"error parsing playlist metafile"); eMsg += e.what();
throw XmlRpcInvalidDataException(eMsg);
} }
// read the content array corresponding to the playlist // read the content array corresponding to the playlist
@ -1885,11 +1891,11 @@ WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
audioClip->configure(*root); audioClip->configure(*root);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::string eMsg = "semantic error in audio clip metafile:\n"; std::string eMsg = "semantic error in audio clip metafile: ";
eMsg += e.what(); eMsg += e.what();
throw XmlRpcInvalidDataException(eMsg); throw XmlRpcInvalidDataException(eMsg);
} catch (xmlpp::exception &e) { } catch (xmlpp::exception &e) {
std::string eMsg = "error parsing audio clip metafile"; std::string eMsg = "error parsing audio clip metafile: ";
eMsg += e.what(); eMsg += e.what();
throw XmlRpcInvalidDataException(eMsg); throw XmlRpcInvalidDataException(eMsg);
} }

View File

@ -736,8 +736,12 @@ GLiveSupport :: getAudioClip(Ptr<const UniqueId>::Ref id)
{ {
Ptr<AudioClip>::Ref clip; Ptr<AudioClip>::Ref clip;
clip = (*openedAudioClips)[id->getId()]; AudioClipMap::iterator it = openedAudioClips->find(id->getId());
if (!clip.get()) { if (it != openedAudioClips->end()) {
clip = it->second;
}
if (!clip || !clip->getToken()) {
clip = storage->getAudioClip(sessionId, id); clip = storage->getAudioClip(sessionId, id);
(*openedAudioClips)[id->getId()] = clip; (*openedAudioClips)[id->getId()] = clip;
} }
@ -757,8 +761,10 @@ GLiveSupport :: acquireAudioClip(Ptr<const UniqueId>::Ref id)
{ {
Ptr<AudioClip>::Ref clip; Ptr<AudioClip>::Ref clip;
clip = (*openedAudioClips)[id->getId()]; AudioClipMap::iterator it = openedAudioClips->find(id->getId());
if (!clip.get() || !clip->getToken().get()) { if (it != openedAudioClips->end()) {
clip = it->second;
} else {
clip = storage->acquireAudioClip(sessionId, id); clip = storage->acquireAudioClip(sessionId, id);
(*openedAudioClips)[id->getId()] = clip; (*openedAudioClips)[id->getId()] = clip;
} }
@ -778,8 +784,10 @@ GLiveSupport :: getPlaylist(Ptr<const UniqueId>::Ref id)
{ {
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
playlist = (*openedPlaylists)[id->getId()]; PlaylistMap::iterator it = openedPlaylists->find(id->getId());
if (!playlist.get()) { if (it != openedPlaylists->end()) {
playlist = it->second;
} else {
playlist = storage->getPlaylist(sessionId, id); playlist = storage->getPlaylist(sessionId, id);
(*openedPlaylists)[id->getId()] = playlist; (*openedPlaylists)[id->getId()] = playlist;
} }
@ -799,8 +807,12 @@ GLiveSupport :: acquirePlaylist(Ptr<const UniqueId>::Ref id)
{ {
Ptr<Playlist>::Ref playlist; Ptr<Playlist>::Ref playlist;
playlist = (*openedPlaylists)[id->getId()]; PlaylistMap::iterator it = openedPlaylists->find(id->getId());
if (!playlist.get() || !playlist->getUri().get()) { if (it != openedPlaylists->end()) {
playlist = it->second;
}
if (!playlist || !playlist->getUri()) {
playlist = storage->acquirePlaylist(sessionId, id); playlist = storage->acquirePlaylist(sessionId, id);
(*openedPlaylists)[id->getId()] = playlist; (*openedPlaylists)[id->getId()] = playlist;
} }
@ -827,7 +839,7 @@ GLiveSupport :: getPlayable(Ptr<const UniqueId>::Ref id)
} else { } else {
throw XmlRpcInvalidArgumentException( throw XmlRpcInvalidArgumentException(
"invalid ID in GLiveSupport::acquirePlayable"); "invalid ID in GLiveSupport::getPlayable");
} }
return playable; return playable;
@ -873,7 +885,7 @@ GLiveSupport :: uncachePlaylist(Ptr<const UniqueId>::Ref id)
if ((it = openedPlaylists->find(id->getId())) != end) { if ((it = openedPlaylists->find(id->getId())) != end) {
playlist = (*openedPlaylists)[id->getId()]; playlist = (*openedPlaylists)[id->getId()];
if (playlist->getUri().get()) { if (playlist->getUri()) {
storage->releasePlaylist(playlist); storage->releasePlaylist(playlist);
} }
@ -893,7 +905,7 @@ GLiveSupport :: releaseOpenedAudioClips(void) throw (XmlRpcException)
AudioClipMap::iterator end = openedAudioClips->end(); AudioClipMap::iterator end = openedAudioClips->end();
while (it != end) { while (it != end) {
Ptr<AudioClip>::Ref clip = (*it).second; Ptr<AudioClip>::Ref clip = it->second;
if (clip->getToken().get()) { if (clip->getToken().get()) {
storage->releaseAudioClip(clip); storage->releaseAudioClip(clip);
@ -917,9 +929,9 @@ GLiveSupport :: releaseOpenedPlaylists(void) throw (XmlRpcException)
PlaylistMap::iterator end = openedPlaylists->end(); PlaylistMap::iterator end = openedPlaylists->end();
while (it != end) { while (it != end) {
Ptr<Playlist>::Ref playlist = (*it).second; Ptr<Playlist>::Ref playlist = it->second;
if (playlist->getUri().get()) { if (playlist->getUri()) {
storage->releasePlaylist(playlist); storage->releasePlaylist(playlist);
} }