Author: lcorneliussen
Date: Thu Jan  5 07:33:26 2012
New Revision: 1227511

URL: http://svn.apache.org/viewvc?rev=1227511&view=rev
Log:
[NPANDAY-370] Build NPanday from sources on OSX/MONO

o Do not require npanday-settings.xml on !win
o Do not try to access the windows registry :-)

Modified:
    
incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java
    
incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java

Modified: 
incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java?rev=1227511&r1=1227510&r2=1227511&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java
 Thu Jan  5 07:33:26 2012
@@ -21,6 +21,7 @@ package npanday.registry.impl;
 
 import npanday.registry.WindowsRegistryAccessException;
 import npanday.registry.WindowsRegistryAccessProvider;
+import org.codehaus.plexus.util.Os;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -112,6 +113,9 @@ public class WinRegistry
             );
             regDeleteKey.setAccessible( true );
         }
+        catch (NoSuchMethodException e){
+           // we are not on windows, then!
+        }
         catch ( Exception e )
         {
             e.printStackTrace();
@@ -507,6 +511,9 @@ public class WinRegistry
     public String getValue(
         RegistryHKey registryHKey, String key, String valueName ) throws 
WindowsRegistryAccessException
     {
+        if (!Os.isFamily( Os.FAMILY_WINDOWS ))
+            return null;
+
         try
         {
             return WinRegistry.readString(

Modified: 
incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java?rev=1227511&r1=1227510&r2=1227511&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java
 Thu Jan  5 07:33:26 2012
@@ -25,6 +25,7 @@ import npanday.registry.RepositoryRegist
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.logging.Log;
 import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.Os;
 
 import javax.naming.OperationNotSupportedException;
 import java.io.File;
@@ -118,14 +119,15 @@ public class SettingsUtil
             log,
             repositoryRegistry,
             settingsPathOrFile,
-            /*throw error, if file doesn exist*/ true );
+            /* throw error, if file doesn't exist on windows */
+            Os.isFamily( Os.FAMILY_WINDOWS ) );
     }
 
     /**
      * Applies the custom settings provided in settingsPathOrFile, if the file 
does exist.
      *
      * @param settingsPathOrFile If a path, 'npanday-settings.xml' is added.
-     * @throws MojoExecutionException If anything goes wrong reading or 
initializing the settings
+     * @throws MojoExecutionException If anything goes wrong 
reddddddddddddddddddading or initializing the settings
      */
     public static boolean applyCustomSettingsIfAvailable( Log log, 
RepositoryRegistry repositoryRegistry,
                                                    String settingsPathOrFile)


Reply via email to