Author: mlandres Date: Wed Jul 18 12:36:39 2007 New Revision: 6058 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6058&view=rev Log: - Fixed repo::provideFile to throw on error. - Fixed ResolvableQuery to use 0 as default for non existing numerical values. Modified: trunk/libzypp/zypp/base/Exception.h trunk/libzypp/zypp/cache/ResolvableQuery.h trunk/libzypp/zypp/repo/RepoProvideFile.cc Modified: trunk/libzypp/zypp/base/Exception.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Exception.h?rev=6058&r1=6057&r2=6058&view=diff ============================================================================== --- trunk/libzypp/zypp/base/Exception.h (original) +++ trunk/libzypp/zypp/base/Exception.h Wed Jul 18 12:36:39 2007 @@ -16,6 +16,8 @@ #include <iosfwd> #include <stdexcept> +#include "zypp/base/Gettext.h" + /////////////////////////////////////////////////////////////////// namespace zypp { ///////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/cache/ResolvableQuery.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/ResolvableQuery.h?rev=6058&r1=6057&r2=6058&view=diff ============================================================================== --- trunk/libzypp/zypp/cache/ResolvableQuery.h (original) +++ trunk/libzypp/zypp/cache/ResolvableQuery.h Wed Jul 18 12:36:39 2007 @@ -38,7 +38,7 @@ * \param dbdir Cache location path */ ResolvableQuery( const Pathname &dbdir ); - + ~ResolvableQuery(); /** @@ -64,17 +64,16 @@ * \param klass Attribute Class * \param name Attribute Name * - * \return The attribute or -1 if - * no record is found. + * \return The attribute or \c 0 if no record is found. */ int queryNumericAttribute( const data::RecordId &record_id, const std::string &klass, const std::string &name, - int default_value = -1 ); + int default_value = 0 ); /** \overload */ int queryNumericAttribute( const data::RecordId &record_id, const Attribute& attr, - int default_value = -1 ) + int default_value = 0 ) { return queryNumericAttribute( record_id, attr.klass, attr.name, default_value ); } Modified: trunk/libzypp/zypp/repo/RepoProvideFile.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoProvideFile.cc?rev=6058&r1=6057&r2=6058&view=diff ============================================================================== --- trunk/libzypp/zypp/repo/RepoProvideFile.cc (original) +++ trunk/libzypp/zypp/repo/RepoProvideFile.cc Wed Jul 18 12:36:39 2007 @@ -13,8 +13,8 @@ #include <fstream> #include <sstream> #include <set> -#include "zypp/base/Logger.h" +#include "zypp/base/Logger.h" #include "zypp/repo/RepoProvideFile.h" #include "zypp/ZYppCallbacks.h" #include "zypp/MediaSetAccess.h" @@ -82,7 +82,7 @@ const OnMediaLocation & loc_r, const ProvideFilePolicy & policy_r ) { - MIL << "sourceProvideFile " << loc_r << endl; + MIL << "provideFile " << loc_r << endl; // Arrange DownloadFileReportHack to recieve the source::DownloadFileReport // and redirect download progress triggers to call the ProvideFilePolicy // callback. @@ -95,8 +95,8 @@ RepoInfo info = repo_r.info(); set<Url> urls = info.baseUrls(); if ( urls.empty() ) - ZYPP_THROW(Exception("No url in repository.")); - + ZYPP_THROW(Exception(_("No url in repository."))); + for ( RepoInfo::urls_const_iterator it = urls.begin(); it != urls.end(); ++it ) @@ -104,12 +104,12 @@ url = *it; try { - + MediaSetAccess access(url); - + ManagedFile ret( access.provideFile(loc_r), RepoReleaseFile( repo_r, loc_r.filename(), loc_r.medianr() ) ); - + if ( loc_r.checksum().empty() ) { // no checksum in metadata @@ -120,7 +120,7 @@ std::ifstream input( ret->asString().c_str() ); CheckSum retChecksum( loc_r.checksum().type(), input ); input.close(); - + if ( loc_r.checksum() != retChecksum ) { // failed integity check @@ -138,16 +138,20 @@ WAR << "NO failOnChecksumError: " << err.str() << endl; } } - - MIL << "sourceProvideFile at " << ret << endl; + + MIL << "provideFile at " << ret << endl; return ret; } catch ( const Exception &e ) { - ERR << "Trying next url" << endl; + ZYPP_CAUGHT( e ); + WAR << "Trying next url" << endl; continue; } } // iteration over urls + + ZYPP_THROW(Exception(_("No more urls in repository."))); + return ManagedFile(); // not reached } ///////////////////////////////////////////////////////////////// -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org