felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r654898 - in /felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository: LocalRepositoryImpl.java RequirementImpl.java
Date Fri, 09 May 2008 17:52:04 GMT
Author: rickhall
Date: Fri May  9 10:52:04 2008
New Revision: 654898

URL: http://svn.apache.org/viewvc?rev=654898&view=rev
Log:
Modified RequirementImpl to throw an invalid syntax exception instead of
swallowing it, which required further modifications to LocalRepositoryImpl
to ignore resources with invalid filters. (FELIX-484)

Modified:
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/RequirementImpl.java

Modified: felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java?rev=654898&r1=654897&r2=654898&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
(original)
+++ felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/LocalRepositoryImpl.java
Fri May  9 10:52:04 2008
@@ -98,7 +98,16 @@
         // convert the bundle headers to the appropriate resource metadata.
         for (int i = 0; (bundles != null) && (i < bundles.length); i++)
         {
-            m_localResourceList.add(new LocalResourceImpl(bundles[i]));
+            try
+            {
+                m_localResourceList.add(new LocalResourceImpl(bundles[i]));
+            }
+            catch (InvalidSyntaxException ex)
+            {
+                // This should never happen since we are generating filters,
+                // but ignore the resource if it does occur.
+                System.err.println(ex);
+            }
         }
     }
 
@@ -106,12 +115,13 @@
     {
         private Bundle m_bundle = null;
 
-        LocalResourceImpl(Bundle bundle)
+        LocalResourceImpl(Bundle bundle) throws InvalidSyntaxException
         {
             this(null, bundle);
         }
 
         LocalResourceImpl(ResourceImpl resource, Bundle bundle)
+            throws InvalidSyntaxException
         {
             super(resource);
             m_bundle = bundle;
@@ -123,7 +133,7 @@
             return m_bundle;
         }
 
-        private void initialize()
+        private void initialize() throws InvalidSyntaxException
         {
             Dictionary dict = m_bundle.getHeaders();
 
@@ -232,6 +242,7 @@
         }
 
         private void convertImportPackageToRequirement(Dictionary dict)
+            throws InvalidSyntaxException
         {
             String target = (String) dict.get(Constants.IMPORT_PACKAGE);
             if (target != null)
@@ -271,13 +282,14 @@
                             + imports[impIdx].getName() + ")"
                             + low + ")");
                     }
-                    
+
                     addRequire(req);
                 }
             }
         }
 
         private void convertImportServiceToRequirement(Dictionary dict)
+            throws InvalidSyntaxException
         {
             String target = (String) dict.get(Constants.IMPORT_SERVICE);
             if (target != null)
@@ -329,4 +341,4 @@
             }
         }
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/RequirementImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/RequirementImpl.java?rev=654898&r1=654897&r2=654898&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/RequirementImpl.java
(original)
+++ felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/RequirementImpl.java
Fri May  9 10:52:04 2008
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -52,17 +52,9 @@
         return m_filter.toString();
     }
 
-    public synchronized void setFilter(String filter)
+    public synchronized void setFilter(String filter) throws InvalidSyntaxException
     {
-        try
-        {
-            m_filter = RepositoryAdminImpl.m_context.createFilter(filter);
-        }
-        catch (InvalidSyntaxException ex)
-        {
-            m_filter = null;
-            System.err.println(ex);
-        }
+        m_filter = RepositoryAdminImpl.m_context.createFilter(filter);
     }
 
     public synchronized boolean isSatisfied(Capability capability)



Mime
View raw message