summaryrefslogtreecommitdiff
path: root/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-16 23:05:54 +0100
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-16 23:05:54 +0100
commitbb9f382d1024e60f672b9c484031f40772a54a4b (patch)
tree32ca1fa8894b54aca1e0fbed596e4f7b1f0adaca /src/main/java/org/apache/maven/plugin/nar/NarUtil.java
parent9da8be3cb31159c4d44d72f98de663c8350ff770 (diff)
downloadmaven-nar-plugin-bb9f382d1024e60f672b9c484031f40772a54a4b.tar.gz
maven-nar-plugin-bb9f382d1024e60f672b9c484031f40772a54a4b.tar.bz2
maven-nar-plugin-bb9f382d1024e60f672b9c484031f40772a54a4b.tar.xz
maven-nar-plugin-bb9f382d1024e60f672b9c484031f40772a54a4b.zip
Reformat
Diffstat (limited to 'src/main/java/org/apache/maven/plugin/nar/NarUtil.java')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUtil.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
index 049cdde..a18c97c 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
@@ -57,7 +57,9 @@ public class NarUtil
defaults = PropertyUtils.loadProperties( NarUtil.class.getResourceAsStream( "aol.properties" ) );
}
if ( defaults == null )
+ {
throw new MojoFailureException( "NAR: Could not load default properties file: 'aol.properties'." );
+ }
return defaults;
}
@@ -70,11 +72,17 @@ public class NarUtil
os = System.getProperty( "os.name" );
String name = os.toLowerCase();
if ( name.startsWith( "windows" ) )
+ {
os = OS.WINDOWS;
+ }
if ( name.startsWith( "linux" ) )
+ {
os = OS.LINUX;
+ }
if ( name.equals( "mac os x" ) )
+ {
os = OS.MACOSX;
+ }
}
return os;
}
@@ -141,7 +149,9 @@ public class NarUtil
throws MojoExecutionException, MojoFailureException
{
if ( !file.exists() )
+ {
return;
+ }
if ( file.isDirectory() )
{
@@ -246,7 +256,9 @@ public class NarUtil
{
int slashEIndex = s.indexOf( "\\E" );
if ( slashEIndex == -1 )
+ {
return "\\Q" + s + "\\E";
+ }
StringBuffer sb = new StringBuffer( s.length() * 2 );
sb.append( "\\Q" );
@@ -267,7 +279,9 @@ public class NarUtil
private static String quoteReplacement( String s )
{
if ( ( s.indexOf( '\\' ) == -1 ) && ( s.indexOf( '$' ) == -1 ) )
+ {
return s;
+ }
StringBuffer sb = new StringBuffer();
for ( int i = 0; i < s.length(); i++ )
{
@@ -462,7 +476,9 @@ public class NarUtil
{
String[] nameValue = env[i].split( "=", 2 );
if ( nameValue.length < 2 )
+ {
throw new MojoFailureException( " Misformed env: '" + env[i] + "'" );
+ }
dbg.println( " '" + nameValue[0] + "=" + nameValue[1] + "'" );
cmdLine.addEnvironment( nameValue[0], nameValue[1] );
}