You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/09/10 01:31:04 UTC

svn commit: r279916 - /beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java

Author: rich
Date: Fri Sep  9 16:31:00 2005
New Revision: 279916

URL: http://svn.apache.org/viewcvs?rev=279916&view=rev
Log:
This is an amendment to my last checkin, which was overzealous about removing the "web.source.roots" option.  This puts it back (sorry).

tests: bvt in netui (WinXP)
BB: self (linux)


Modified:
    beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java

Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java?rev=279916&r1=279915&r2=279916&view=diff
==============================================================================
--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java (original)
+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java Fri Sep  9 16:31:00 2005
@@ -1274,19 +1274,21 @@
     public static String[] getWebSourceRoots( AnnotationProcessorEnvironment env )
         throws FatalCompileTimeException
     {
-        return ( String[] ) getOption( "-sourcepath", true, env );
+        String[] legacyOption = getOption( "-Aweb.source.roots", false, env );  // deprecated - TODO: deprecation message
+        if ( legacyOption != null ) return legacyOption;
+        return getOption( "-sourcepath", true, env );
     }
     
     public static String[] getWebContentRoots( AnnotationProcessorEnvironment env )
             throws FatalCompileTimeException
     {
-        return ( String[] ) getOption( "-Aweb.content.root", true, env );
+        return getOption( "-Aweb.content.root", true, env );
     }
 
-    private static Object getOption( String optionName, boolean isList, AnnotationProcessorEnvironment env )
+    private static String[] getOption( String optionName, boolean required, AnnotationProcessorEnvironment env )
         throws MissingOptionException
     {
-        Object cached = env.getAttribute( optionName );
+        String[] cached = ( String[] ) env.getAttribute( optionName );
         if ( cached != null ) return cached;
 
         Map options = env.getOptions();
@@ -1308,21 +1310,19 @@
             }
         }
 
-        if ( value == null ) throw new MissingOptionException( optionName );
-
-        Object retVal = value;
+        if ( value == null )
+        {
+            if ( required ) throw new MissingOptionException( optionName );
+            return null;
+        }
 
-        if ( isList )
+        String[] values = value.trim().split( File.pathSeparator );
+        for ( int i = 0; i < values.length; i++ )
         {
-            String[] values = ( ( String ) retVal ).trim().split( File.pathSeparator );
-            for ( int i = 0; i < values.length; i++ )
-            {
-                values[i] = values[i].trim();
-            }
-            retVal = values;
+            values[i] = values[i].trim();
         }
 
-        env.setAttribute( optionName, retVal );
-        return retVal;
+        env.setAttribute( optionName, values );
+        return values;
     }
 }