OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | fractal-commits List | August 2008 Index

<--  Date Index  --> <--  Thread Index  -->

[fractal-commits] [8399] trunk/juliac: Bug fix when there is no <components>.


Title: [8399] trunk/juliac: Bug fix when there is no <components>.
Revision
8399
Author
seintur
Date
2008-08-27 10:17:29 +0200 (Wed, 27 Aug 2008)

Log Message

Bug fix when there is no <components>.

Modified Paths

Diff

Modified: trunk/juliac/compiler/src/main/java/org/objectweb/fractal/juliac/Utils.java (8398 => 8399)


--- trunk/juliac/compiler/src/main/java/org/objectweb/fractal/juliac/Utils.java	2008-08-26 20:05:16 UTC (rev 8398)
+++ trunk/juliac/compiler/src/main/java/org/objectweb/fractal/juliac/Utils.java	2008-08-27 08:17:29 UTC (rev 8399)
@@ -341,4 +341,35 @@
         }
         return f;
     }
+
+    /**
+     * Returns a copy of the specified string, with leading and trailing blank
+     * characters (whitespace, tab and newline) omitted.
+     */
+    public static String trimHeadingAndTrailingBlanks( String src ) {
+        
+        /*
+         * i is the index of the first non blank character.
+         */
+        int i = -1;
+        char c;
+        do {
+            i++;
+            c = src.charAt(i);
+        }
+        while( c==' ' || c=='\t' || c=='\n' );
+        
+        /*
+         * j is the index of the first non blank character from the end of src.
+         */
+        int j = src.length();
+        do {
+            j--;
+            c = src.charAt(j);
+        }
+        while( c==' ' || c=='\t' || c=='\n' );
+    
+        String trim = src.substring(i,j+1);
+        return trim;
+    }
 }

Modified: trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/Component.java (8398 => 8399)


--- trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/Component.java	2008-08-26 20:05:16 UTC (rev 8398)
+++ trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/Component.java	2008-08-27 08:17:29 UTC (rev 8399)
@@ -44,22 +44,35 @@
      * 
      * @parameter
      */
-    public List<InterfaceType> interfaceTypes;
+    private List<InterfaceType> interfaceTypes;
     
     /**
      * The controller descriptor.
      * 
      * @parameter
      */
-    public String controllerDesc;
+    private String controllerDesc;
     
     /**
      * The content descriptor.
      * 
      * @parameter
      */
-    public String contentDesc;
+    private String contentDesc;
+
     
+    // ---------------------------------------------------------------------
+    // Getters
+    // ---------------------------------------------------------------------
+    
+    public String getControllerDesc() {
+        return Utils.trimHeadingAndTrailingBlanks(controllerDesc);
+    }
+    
+    public String getContentDesc() {
+        return Utils.trimHeadingAndTrailingBlanks(contentDesc);
+    }
+    
     /**
      * Return the Fractal component type corresponding to the data stored in the
      * current instance.

Modified: trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/InterfaceType.java (8398 => 8399)


--- trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/InterfaceType.java	2008-08-26 20:05:16 UTC (rev 8398)
+++ trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/InterfaceType.java	2008-08-27 08:17:29 UTC (rev 8399)
@@ -39,41 +39,43 @@
      * 
      * @parameter
      */
-    public String name;
+    private String name;
     
     /**
      * The interface signature.
      * 
      * @parameter
      */
-    public String signature;
+    private String signature;
     
     /**
      * true if the interface is client.
      * 
      * @parameter
      */
-    public boolean isClient;
+    private boolean isClient;
     
     /**
      * true if the interface is optional.
      * 
      * @parameter
      */
-    public boolean isOptional;
+    private boolean isOptional;
     
     /**
      * true if the interface is collection.
      * 
      * @parameter
      */
-    public boolean isCollection;
+    private boolean isCollection;
     
     /**
      * Return the Fractal interface type corresponding to the data stored in the
      * current instance.
      */
     public org.objectweb.fractal.api.type.InterfaceType toFractalInterfaceType() {
+        String name = Utils.trimHeadingAndTrailingBlanks(this.name);
+        String signature = Utils.trimHeadingAndTrailingBlanks(this.signature);
         org.objectweb.fractal.api.type.InterfaceType it =
             new BasicInterfaceType(name,signature,isClient,isOptional,isCollection);
         return it;

Modified: trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/JuliacMojo.java (8398 => 8399)


--- trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/JuliacMojo.java	2008-08-26 20:05:16 UTC (rev 8398)
+++ trunk/juliac/mojo/src/main/java/org/objectweb/fractal/juliac/JuliacMojo.java	2008-08-27 08:17:29 UTC (rev 8399)
@@ -262,7 +262,7 @@
                 
                 String name = sysarg.getKey();
                 String value = sysarg.getValue();
-                value = trimHeadingAndTrailingBlanks(value);
+                value = Utils.trimHeadingAndTrailingBlanks(value);
                 
                 /*
                  * Save the original value of the property in origsysars (for
@@ -294,7 +294,7 @@
         for (Map.Entry<String,String> entry : igs.entrySet()) {
             String asmcg = entry.getKey();
             String scg = entry.getValue();
-            scg = trimHeadingAndTrailingBlanks(scg);
+            scg = Utils.trimHeadingAndTrailingBlanks(scg);
             igs.put(asmcg,scg);
         }
         
@@ -471,10 +471,14 @@
         /*
          * Code generation for components.
          */
-        for (Component component : components) {
-            Juliac.reportInfo(component+"...");
-            Type type = component.toFractalComponentType();
-            jc.generate( type, component.controllerDesc, component.contentDesc );
+        if( components != null ) {
+            for (Component component : components) {
+                Juliac.reportInfo(component+"...");
+                Type type = component.toFractalComponentType();
+                String controllerDesc = component.getControllerDesc();
+                String contentDesc = component.getContentDesc();
+                jc.generate( type, controllerDesc, contentDesc );
+            }
         }
         
         /*
@@ -584,39 +588,8 @@
         String[] srcs = new String[src.size()];
         for (int i = 0; i < src.size(); i++) {
             String s = src.get(i);
-            srcs[i] = trimHeadingAndTrailingBlanks(s);
+            srcs[i] = Utils.trimHeadingAndTrailingBlanks(s);
         }
         return srcs;
     }
-    
-    /**
-     * Returns a copy of the specified string, with leading and trailing blank
-     * characters (whitespace, tab and newline) omitted.
-     */
-    private static String trimHeadingAndTrailingBlanks( String src ) {
-        
-        /*
-         * i is the index of the first non blank character.
-         */
-        int i = -1;
-        char c;
-        do {
-            i++;
-            c = src.charAt(i);
-        }
-        while( c==' ' || c=='\t' || c=='\n' );
-        
-        /*
-         * j is the index of the first non blank character from the end of src.
-         */
-        int j = src.length();
-        do {
-            j--;
-            c = src.charAt(j);
-        }
-        while( c==' ' || c=='\t' || c=='\n' );
-
-        String trim = src.substring(i,j+1);
-        return trim;
-    }
 }


<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.