Author: jocaba
Date: Tue Dec  7 08:26:29 2010
New Revision: 1042933

URL: http://svn.apache.org/viewvc?rev=1042933&view=rev
Log:
[NPANDAY-354] Addin 'resync references' feature fails if using remote 
repositories but there is no 'mirrors' section in Settings.xml file

Committed fix submitted by Paul G

Modified:
    
incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs

Modified: 
incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs?rev=1042933&r1=1042932&r2=1042933&view=diff
==============================================================================
--- 
incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs
 (original)
+++ 
incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/main/csharp/NPanday/ProjectImporter/Digest/Model/Reference.cs
 Tue Dec  7 08:26:29 2010
@@ -281,16 +281,19 @@ namespace NPanday.ProjectImporter.Digest
 
                 Dictionary<string, string> mirrors = new Dictionary<string, 
string>();
 
-                foreach (Mirror mirror in settings.mirrors)
+                if (settings.mirrors != null)
                 {
-                    string id = mirror.mirrorOf;
-                    if (id == "external:*") id = "*";
-                    // TODO: support '!' syntax
-                    mirrors.Add(id, mirror.url);
+                    foreach (Mirror mirror in settings.mirrors)
+                    {
+                        string id = mirror.mirrorOf;
+                        if (id == "external:*") id = "*";
+                        // TODO: support '!' syntax
+                        mirrors.Add(id, mirror.url);
+                    }
                 }
 
                 Dictionary<string,string> repos = new 
Dictionary<string,string>();
-                repos.Add("central", "http://repo1.maven.org/maven2"; );
+                
                 foreach (Profile profile in settings.profiles)
                 {
                     if (activeProfiles.Contains(profile.id) && 
profile.repositories != null)
@@ -302,6 +305,13 @@ namespace NPanday.ProjectImporter.Digest
                     }
                 }
 
+                // ensure there is at least one repo defined
+                // TODO: this is just a temporary implementation
+                if (repos.Count == 0)
+                {
+                    repos.Add("central", "http://repo1.maven.org/maven2";);
+                }
+
                 // TODO: sustain correct ordering from settings.xml
                 foreach (string id in repos.Keys)
                 {


Reply via email to