You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/10/16 09:50:02 UTC

svn commit: r825790 - /tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java

Author: antelder
Date: Fri Oct 16 07:50:01 2009
New Revision: 825790

URL: http://svn.apache.org/viewvc?rev=825790&view=rev
Log:
Fix otest JCA 3001

Modified:
    tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java

Modified: tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java?rev=825790&r1=825789&r2=825790&view=diff
==============================================================================
--- tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java (original)
+++ tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java Fri Oct 16 07:50:01 2009
@@ -244,87 +244,92 @@
     private static List<Class<?>> JCA30008_ANNOTATIONS = Arrays.asList(new Class<?>[] {Intent.class, Qualifier.class}); 
     
     private void checkForbiddenAnnotations(JavaInterfaceContract javaInterfaceContract) {
-        if (javaInterfaceContract.getInterface() != null) {
-            Class<?> ifc = ((JavaInterface) javaInterfaceContract.getInterface()).getJavaClass();
-            if (ifc != null) {
-                for (Annotation a : ifc.getAnnotations()) {
-                    if (ifc.isInterface()) {
-                        if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
-                    } else {
-                        if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
-                    }
+        if (javaInterfaceContract.getInterface() == null) {
+            return;
+        }
+        Class<?> ifc = ((JavaInterface) javaInterfaceContract.getInterface()).getJavaClass();
+        if (ifc == null) {
+            return;
+        }
+        for (Annotation a : ifc.getAnnotations()) {
+            if (ifc.isInterface()) {
+                if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
+                    error("ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
+                }
+            } else {
+                if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
+                    error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
                 }
             }
-            for (Method m : ifc.getMethods()) {
-                for (Annotation a : m.getAnnotations()) {
-                    if (ifc.isInterface()) {
-                        if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
-                    } else {
-                        if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
+        }
+        for (Method m : ifc.getMethods()) {
+            for (Annotation a : m.getAnnotations()) {
+                if (ifc.isInterface()) {
+                    if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
+                        error("ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
+                    }
+                } else {
+                    if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
+                        error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
                     }
                 }
             }
-            for (Field f : ifc.getFields()) {
-                for (Annotation a : f.getAnnotations()) {
-                    if (ifc.isInterface()) {
-                        if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
-                    } else {
-                        if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
+        }
+        for (Field f : ifc.getFields()) {
+            for (Annotation a : f.getAnnotations()) {
+                if (ifc.isInterface()) {
+                    if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
+                        error("ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
+                    }
+                } else {
+                    if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
+                        error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
                     }
                 }
             }
         }
         
-        if (javaInterfaceContract.getCallbackInterface() != null) {
-            Class<?> ifc = ((JavaInterface) javaInterfaceContract.getCallbackInterface()).getJavaClass();
-            if (ifc != null) {
-                for (Annotation a : ifc.getAnnotations()) {
-                    if (ifc.isInterface()) {
-                        if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
-                    } else {
-                        if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
-                    }
+        if (javaInterfaceContract.getCallbackInterface() == null) {
+            return;
+        }
+        ifc = ((JavaInterface) javaInterfaceContract.getCallbackInterface()).getJavaClass();
+        if (ifc == null) {
+            return;
+        }
+
+        for (Annotation a : ifc.getAnnotations()) {
+            if (ifc.isInterface()) {
+                if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
+                    error("ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
+                }
+            } else {
+                if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
+                    error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
                 }
             }
-            for (Method m : ifc.getMethods()) {
-                for (Annotation a : m.getAnnotations()) {
-                    if (ifc.isInterface()) {
-                        if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
-                    } else {
-                        if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
+        }
+        for (Method m : ifc.getMethods()) {
+            for (Annotation a : m.getAnnotations()) {
+                if (ifc.isInterface()) {
+                    if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
+                        error("ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
+                    }
+                } else {
+                    if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
+                        error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
                     }
                 }
             }
-            for (Field f : ifc.getFields()) {
-                for (Annotation a : f.getAnnotations()) {
-                    if (ifc.isInterface()) {
-                        if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
-                    } else {
-                        if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
-                            error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
-                        }
+        }
+        for (Field f : ifc.getFields()) {
+            for (Annotation a : f.getAnnotations()) {
+                if (ifc.isInterface()) {
+                    if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
+                        error("ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
+                    }
+                } else {
+                    if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
+                        error("ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
                     }
                 }
             }