felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r992272 - /felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryPreferences.java
Date Fri, 03 Sep 2010 12:10:01 GMT
Author: dsavage
Date: Fri Sep  3 12:10:00 2010
New Revision: 992272

URL: http://svn.apache.org/viewvc?rev=992272&view=rev
Log:
fix handling of static providers after changes in FELIX-1355

Modified:
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryPreferences.java

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryPreferences.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryPreferences.java?rev=992272&r1=992271&r2=992272&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryPreferences.java
(original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/repository/RepositoryPreferences.java
Fri Sep  3 12:10:00 2010
@@ -295,51 +295,53 @@ public class RepositoryPreferences imple
     {
         RepositoryModel element = new RepositoryModel(id, type);
 
-        String loc = prefs.getString(key + LOC);
+        Properties props = element.getProperties();
+        if ( type.isDynamic()) {
+            String loc = prefs.getString(key + LOC);
 
-        if (loc == null || loc.trim().length() == 0)
-        {
-            loc = makeFileName(element);
-        }
-
-        if (new File(loc).exists())
-        {
-            FileInputStream in = null; 
-            try
+            if (loc == null || loc.trim().length() == 0)
             {
-                in = new FileInputStream(loc);
-                Properties props = element.getProperties();
-                props.load(in);
-                
-                if (type.isDynamic() && !props.containsKey(RepositoryModel.NAME))
{
-                    String name = prefs.getString(key + NAME);
-                    props.setProperty(RepositoryModel.NAME, name);
-                }
-                
-                if (!props.containsKey(IRepositoryConfig.REPOSITORY_PROVIDER)) {
-                    props.put(IRepositoryConfig.REPOSITORY_PROVIDER, type.getProvider());
-                }
-
+                loc = makeFileName(element);
             }
-            catch (IOException e)
+
+            if (new File(loc).exists())
             {
-                SigilCore.error("Failed to load properties for repository " + key, e);
-            }
-            finally {
-                if ( in != null ) {
-                    try
-                    {
-                        in.close();
+                FileInputStream in = null; 
+                try
+                {
+                    in = new FileInputStream(loc);
+                    props.load(in);
+                    
+                    if (type.isDynamic() && !props.containsKey(RepositoryModel.NAME))
{
+                        String name = prefs.getString(key + NAME);
+                        props.setProperty(RepositoryModel.NAME, name);
                     }
-                    catch (IOException e)
-                    {
-                        SigilCore.error("Failed to close properties file " + loc, e);
+                    
+                }
+                catch (IOException e)
+                {
+                    SigilCore.error("Failed to load properties for repository " + key, e);
+                }
+                finally {
+                    if ( in != null ) {
+                        try
+                        {
+                            in.close();
+                        }
+                        catch (IOException e)
+                        {
+                            SigilCore.error("Failed to close properties file " + loc, e);
+                        }
                     }
                 }
             }
         }
 
-        element.getProperties().setProperty("id", id);
+        if (!props.containsKey(IRepositoryConfig.REPOSITORY_PROVIDER)) {
+            props.setProperty(IRepositoryConfig.REPOSITORY_PROVIDER, type.getProvider());
+        }
+
+        props.setProperty("id", id);
 
         return element;
     }



Mime
View raw message