Author: michiel
Date: 2010-07-30 12:01:07 +0200 (Fri, 30 Jul 2010)
New Revision: 43022

Modified:
   
mmbase/trunk/maven/maven-mmbase-plugin/src/main/java/org/mmbase/mojo/remote/RmiGenerator.java
Log:
anticipate checked exceptions 

Modified: 
mmbase/trunk/maven/maven-mmbase-plugin/src/main/java/org/mmbase/mojo/remote/RmiGenerator.java
===================================================================
--- 
mmbase/trunk/maven/maven-mmbase-plugin/src/main/java/org/mmbase/mojo/remote/RmiGenerator.java
       2010-07-29 15:28:05 UTC (rev 43021)
+++ 
mmbase/trunk/maven/maven-mmbase-plugin/src/main/java/org/mmbase/mojo/remote/RmiGenerator.java
       2010-07-30 10:01:07 UTC (rev 43022)
@@ -93,11 +93,19 @@
             paramCounter++;
         }
 
+
         indent4();
         Type returnType = m.getGenericReturnType();
         if (!returnType.equals(Void.TYPE)) {
+            buffer.append("final ");
             appendTypeInfo(returnType,true);
-            buffer.append(" retval = (");
+            buffer.append(" retval;\n");
+        }
+        indent4();
+        buffer.append("try {\n");
+        indent6();
+        if (!returnType.equals(Void.TYPE)) {
+            buffer.append("retval = (");
             appendTypeInfo(returnType,true);
             buffer.append(")");
         }
@@ -134,6 +142,13 @@
         }
         buffer.append(");\n");
 
+        indent4();
+        buffer.append("}\n");
+        indent4();
+        buffer.append("catch (RuntimeException rte) { throw rte; }\n");
+        indent4();
+        buffer.append("catch (Exception ex) { throw new 
RemoteException(ex.getMessage(), ex); }\n");
+
         if (!returnType.equals(Void.TYPE)) {
             indent4();
             buffer.append("return retval;\n");
@@ -159,15 +174,13 @@
             Type[] typeParameters = 
getListIteratorTypeParameters(currentClass);
             appendListTypeParameters(typeParameters, true, false);
             isExtendingRemote = true;
-        }
-        else {
+        } else {
             if (isList(currentClass)) {
                 buffer.append(" extends RemoteBridgeList_Rmi");
                 Type[] typeParameters = getListTypeParameters(currentClass);
                 appendListTypeParameters(typeParameters, true, false);
                 isExtendingRemote = true;
-            }
-            else {
+            } else {
                 buffer.append(" extends ServerMappedObject_Rmi<");
                 buffer.append(originalName);
                 buffer.append("> ");

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to