Author: apadilla
Date: Sun Mar 20 14:54:45 2011
New Revision: 1083455

URL: http://svn.apache.org/viewvc?rev=1083455&view=rev
Log:
[NPANDAY-379] - added checking to catch exception properly

Modified:
    
incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/StringConfigurationAppender.java
    
incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs

Modified: 
incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/StringConfigurationAppender.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/StringConfigurationAppender.java?rev=1083455&r1=1083454&r2=1083455&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/StringConfigurationAppender.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-plugin/src/main/java/npanday/plugin/StringConfigurationAppender.java
 Sun Mar 20 14:54:45 2011
@@ -34,11 +34,17 @@ public class StringConfigurationAppender
         Object value = fieldInfo.getValue();
         if ( ! ( value instanceof String ) )
         {
-            throw new MojoExecutionException( "" );
+            if ( value != null )
+            {
+                System.out.println( "CLASS:" + value.getClass().getName() );
+                throw new MojoExecutionException( "" );
+            }
+        }
+        else
+        {
+            Node n1 = document.createElement( fieldInfo.getName());
+            n1.setTextContent( (String) fieldInfo.getValue() );
+            element.appendChild( n1 );
         }
-
-        Node n1 = document.createElement( fieldInfo.getName());
-        n1.setTextContent( (String) fieldInfo.getValue() );
-        element.appendChild( n1 );
     }
 }

Modified: 
incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs?rev=1083455&r1=1083454&r2=1083455&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs
 (original)
+++ 
incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs
 Sun Mar 20 14:54:45 2011
@@ -46,13 +46,10 @@ namespace NPanday.Plugin.Settings
             string outputFile;
             if (String.IsNullOrEmpty( npandaySettingsPath ))
             {
-                outputFile = Environment.GetEnvironmentVariable("USERPROFILE") 
+ "/.m2/npanday-settings.xml";
+                npandaySettingsPath = 
Environment.GetEnvironmentVariable("USERPROFILE") + "/.m2";
             }
-            else
-            {
-                outputFile = npandaySettingsPath + "/npanday-settings.xml";
-            }
-
+            outputFile = npandaySettingsPath + "/npanday-settings.xml";
+            
             XmlSerializer serializer = new 
XmlSerializer(typeof(npandaySettings));
 
             npandaySettings  settings = new npandaySettings();
@@ -77,23 +74,27 @@ namespace NPanday.Plugin.Settings
             }
 
             npandaySettingsVendorsVendor[] monoVendors = null;
-            try
-            {
-                monoVendors = GetVendorsForMono(monoRegistryKey, 
defaultMonoCLR);
-            }
-            catch(ExecutionException e)
-            {
-                Console.WriteLine(e.ToString());
-            }
-
             npandaySettingsVendorsVendor dotGnuVendor = null;
-            try
-            {
-                dotGnuVendor = 
GetVendorForGnu(Environment.GetEnvironmentVariable("CSCC_LIB_PATH"));
-            }
-            catch(ExecutionException e)
+            
+            if ( File.Exists( outputFile ))
             {
-                Console.WriteLine(e.ToString());
+                try
+                {
+                    monoVendors = GetVendorsForMono(monoRegistryKey, 
defaultMonoCLR);
+                }
+                catch(ExecutionException e)
+                {
+                    Console.WriteLine(e.ToString());
+                }
+
+                try
+                {
+                    dotGnuVendor = 
GetVendorForGnu(Environment.GetEnvironmentVariable("CSCC_LIB_PATH"));
+                }
+                catch(ExecutionException e)
+                {
+                    Console.WriteLine(e.ToString());
+                }
             }
             int monoVendorsLength = (monoVendors == null) ? 0: 
monoVendors.Length;
             int dotGnuVendorLength = (dotGnuVendor == null) ? 0: 1;


Reply via email to