handle exceptions while creating capabilities
authorJiri Srain <jsrain@suse.cz>
Tue, 10 Jan 2006 14:46:40 +0000 (14:46 +0000)
committerJiri Srain <jsrain@suse.cz>
Tue, 10 Jan 2006 14:46:40 +0000 (14:46 +0000)
zypp/target/rpm/RpmDb.cc
zypp/target/rpm/RpmHeader.cc

index ae25864..a7d662a 100644 (file)
@@ -1017,7 +1017,14 @@ const std::list<Package::Ptr> & RpmDb::doGetPackages(ScanDbReport & report)
         || filename->find("/usr/share/magic.mime")
         || filename->find("/opt/gnome/games"))
       {
-       dataCollect.provides.insert(_f.parse(ResTraits<Package>::kind, *filename));
+       try {
+         dataCollect.provides.insert(_f.parse(ResTraits<Package>::kind, *filename));
+       }
+       catch (Exception & excpt_r)
+       {
+         ZYPP_CAUGHT(excpt_r);
+         WAR << "Invalid capability: " << *filename << endl;
+       }
       }
     }
 
index fe8902e..4dc62d5 100644 (file)
@@ -23,6 +23,7 @@
 #include "zypp/CapFactory.h"
 #include "zypp/Rel.h"
 #include "zypp/Package.h"
+#include "zypp/base/Exception.h"
 
 using namespace std;
 
@@ -296,13 +297,21 @@ namespace zypp {
            || ((! pre) && !(f & RPMSENSE_PREREQ)))
          {
            CapFactory _f;
-           Capability cap = _f.parse(
-             ResTraits<Package>::kind,
-             n,
-             op,
-             Edition(v)
-           );
-           ret.insert(cap);
+           try {
+             Capability cap = _f.parse(
+               ResTraits<Package>::kind,
+               n,
+               op,
+               Edition(v)
+             );
+             ret.insert(cap);
+           }
+           catch (Exception & excpt_r)
+           {
+             ZYPP_CAUGHT(excpt_r);
+             WAR << "Invalid capability: " << n << " " << op << " "
+               << v << endl;
+           }
          }
         }