Author: mmerz
Date: Tue Jan 25 16:56:57 2005
New Revision: 126452

URL: http://svn.apache.org/viewcvs?view=rev&rev=126452
Log:
More and better error checks and notifications...


Modified:
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181MethodMetadataImpl.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaMethodInfo.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaParameterInfo.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaTypeInfo.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorMethodInfo.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorParameterInfo.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorTypeInfo.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/TypeMirrorUtil.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181MethodMetadataImpl.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181MethodMetadataImpl.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181MethodMetadataImpl.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181MethodMetadataImpl.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181MethodMetadataImpl.java
   (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181MethodMetadataImpl.java
   Tue Jan 25 16:56:57 2005
@@ -240,12 +240,14 @@
         if (null != parameters) {
             params.addAll(parameters);
         }
+        // todo: checks
     }
 
     public void addParam(Jsr181ParameterMetadata parameter) {
         if (null != parameter) {
             params.add(parameter);
         }
+        // todo: checks
     }
 
     public String getJavaMethodName() {

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
     (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
     Tue Jan 25 16:56:57 2005
@@ -99,13 +99,13 @@
         super();
         
         if (null == jt) {
-            throw new IllegalArgumentException("illegal java type info: 
<null>");
+            jt.logError("illegal java type info: <null>");
         }
 
         // check required parameter: wsAnnotation
         WebService wsAnnotation = jt.getAnnotation(WebService.class);
         if (null == wsAnnotation) {
-            throw new IllegalArgumentException("no @WebService annotation 
found");
+            jt.logError("no @WebService annotation found");
         }
 
         // get webMethods
@@ -124,7 +124,7 @@
                 if (null != jm.getAnnotation(WebMethod.class)) {
                     Jsr181MethodMetadata wsmm = new 
Jsr181MethodMetadataImpl(jm);
                     if (null == wsmm) {
-                        throw new ValidationException("illegal web method: " + 
jm.getMethodName());
+                        jt.logError("illegal web method: " + 
jm.getMethodName());
                     }
                     webMethods.add(wsmm);
                 }
@@ -134,41 +134,41 @@
         // check required parameters: annotations, webMethods
         Collection<Annotation> annotations = jt.getAnnotations();
         if ((null == annotations) || (null == webMethods)) {
-            throw new IllegalArgumentException("no annotations or web methods 
found");
+            jt.logError("no annotations or web methods found");
         }
 
         // check required parameter: className
         className = jt.getName();
         if ((null == className) || (0 == className.length())) {
-            throw new IllegalArgumentException("web service class is null");
+            jt.logError("web service class is null");
         }
         baseLocation = jt.getLocation();
 
         // enforce JSR-181 rules
         if (jt.isFinal() || ! jt.isPublic()) {
-            throw new ValidationException("@WebService class must be public 
but not final");
+            jt.logError("@WebService class must be public but not final");
         }
         if (jt.hasFinalize()) {
-            throw new ValidationException("web service class must not declare 
method: finalize()");
+            jt.logError("web service class must not declare method: 
finalize()");
         }
         if (jt.isInterface()) {
             if (null != wsAnnotation.endpointInterface() && 0 < 
wsAnnotation.endpointInterface().trim().length()) {
-                throw new ValidationException("@WebService.endpointInterface 
not allowed on interfaces");
+                jt.logError("@WebService.endpointInterface not allowed on 
interfaces");
             }
             if (null != wsAnnotation.serviceName() && 0 < 
wsAnnotation.serviceName().trim().length()) {
-                throw new ValidationException("@WebService.serviceName not 
allowed on interfaces");
+                jt.logError("@WebService.serviceName not allowed on 
interfaces");
             }
         }
         else {
             if (jt.isAbstract()) {
-                throw new ValidationException("service implementation bean 
must not be abstract");
+                jt.logError("service implementation bean must not be 
abstract");
             }
             if (! jt.hasDefaultConstructor()) {
-                throw new ValidationException("service implementation bean 
must have default constructor");
+                jt.logError("service implementation bean must have default 
constructor");
             }
         }
         if (null != jt.getAnnotation(SOAPMessageHandlers.class) && null != 
jt.getAnnotation(HandlerChain.class)) {
-            throw new ValidationException("Illegal combination of 
@SOAPMessageHandlers and @HandlerChain");
+            jt.logError("Illegal combination of @SOAPMessageHandlers and 
@HandlerChain");
         }
         String wsdlLocation = wsAnnotation.wsdlLocation();
         if (null != wsdlLocation && 0 < wsdlLocation.trim().length()) {
@@ -176,7 +176,7 @@
                 findResource(wsdlLocation.trim(), baseLocation).openStream();
             }
             catch (Throwable t) {
-                throw new ValidationException("wsdlLocation does not exist: " 
+ wsdlLocation);
+                jt.logError("wsdlLocation does not exist: " + wsdlLocation);
             }
         }
         
@@ -219,7 +219,7 @@
             
             // unsupported annotation
             else {
-                throw new ValidationException("found unsupported annotation: " 
+ a.annotationType().getName());
+                jt.logError("found unsupported annotation: " + 
a.annotationType().getName());
             }
         }
         
@@ -745,7 +745,7 @@
         for (Jsr181ParameterMetadata param : params) {
             Class javaType = param.getJavaType();
             if (null == javaType) {
-                throw new NullPointerException("null is not a valid parameter 
class");
+                throw new ValidationException("<null> is not a valid parameter 
class");
             }
             paramTypes[j++] = javaType;
         }
@@ -753,9 +753,7 @@
         String sig = createCompleteMethodSignature(opName, paramTypes);
         
         if (methodMap.containsKey(sig)) {
-            throw new ValidationException(
-                sig + " is already present in this Web Service and duplicate 
methods are not permitted."
-            );
+            throw new ValidationException(sig + " is already present in this 
Web Service and duplicate methods are not permitted");
         }
         else if 
(SOAPBinding.Style.DOCUMENT.equals(getSoapBinding().getStyle()) && 
methodMap.containsKey(opName)) {
             throw new ValidationException("document-style does not allow 
duplicate methods: " + opName);

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaMethodInfo.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaMethodInfo.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaMethodInfo.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaMethodInfo.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaMethodInfo.java
        (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaMethodInfo.java
        Tue Jan 25 16:56:57 2005
@@ -29,6 +29,8 @@
 
     String getMethodName();
     Class getReturnType();
+    
+    void logError(String msg);
 
     Collection<Annotation> getAnnotations();
     <A extends Annotation> A getAnnotation(Class<A> annotationType);

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaParameterInfo.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaParameterInfo.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaParameterInfo.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaParameterInfo.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaParameterInfo.java
     (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaParameterInfo.java
     Tue Jan 25 16:56:57 2005
@@ -28,6 +28,8 @@
     String getName();
     Class getType();
     
+    void logError(String msg);
+    
     <A extends Annotation> A getAnnotation(Class<A> annotationType);
     Collection<Annotation> getAnnotations();
 }

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaTypeInfo.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaTypeInfo.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaTypeInfo.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaTypeInfo.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaTypeInfo.java
  (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/java/JavaTypeInfo.java
  Tue Jan 25 16:56:57 2005
@@ -34,6 +34,8 @@
     String getName();
     File getLocation();
 
+    void logError(String msg);
+    
     <A extends Annotation> A getAnnotation(Class<A> annotationType);
     Collection<Annotation> getAnnotations();
     

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorMethodInfo.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorMethodInfo.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorMethodInfo.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorMethodInfo.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorMethodInfo.java
   (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorMethodInfo.java
   Tue Jan 25 16:56:57 2005
@@ -29,6 +29,10 @@
 import com.sun.mirror.declaration.Modifier;
 import com.sun.mirror.declaration.ParameterDeclaration;
 
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+import com.sun.mirror.apt.Messager;
+
 import com.sun.mirror.type.AnnotationType;
 
 import org.apache.beehive.wsm.jsr181.model.java.JavaMethodInfo;
@@ -37,23 +41,36 @@
 public class MirrorMethodInfo implements JavaMethodInfo {
     
     protected MethodDeclaration decl;
-    protected List<JavaParameterInfo> parameters =
-        new ArrayList<JavaParameterInfo>();
+    protected AnnotationProcessorEnvironment env;
+    protected Class returnType;
+    protected List<JavaParameterInfo> parameters = new 
ArrayList<JavaParameterInfo>();
     
-    public MirrorMethodInfo(MethodDeclaration decl) {
+    public MirrorMethodInfo(MethodDeclaration decl, 
AnnotationProcessorEnvironment env) {
         if (null == decl) {
             throw new IllegalArgumentException("method declaration: <null>");
         }
         this.decl = decl;
+        this.env = env;
 
+        try {
+            returnType = TypeMirrorUtil.classForName(decl.getReturnType());
+        }
+        catch (ClassNotFoundException e) {
+            logError("cannot find return type: " + decl.getSimpleName());      
  
+        }
+        
         Collection<ParameterDeclaration> pdecls = decl.getParameters();
         if (null != pdecls) {
             for (ParameterDeclaration pdecl : pdecls) {
-                parameters.add(new MirrorParameterInfo(pdecl));
+                parameters.add(new MirrorParameterInfo(pdecl, env));
             }
         }
     }
 
+    public void logError(String msg) {
+        env.getMessager().printError(decl.getPosition(), msg);
+    }
+    
     public boolean isPublic() {
         return decl.getModifiers().contains(Modifier.PUBLIC);
     }
@@ -67,12 +84,7 @@
     }
     
     public Class getReturnType() {
-        Class clazz = null;
-        try {
-            clazz = TypeMirrorUtil.classForName(decl.getReturnType());
-        }
-        catch (Throwable t) { }
-        return clazz;
+        return returnType;
     }
     
     public <A extends Annotation> A getAnnotation(Class<A> annotationType) {

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorParameterInfo.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorParameterInfo.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorParameterInfo.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorParameterInfo.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorParameterInfo.java
        (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorParameterInfo.java
        Tue Jan 25 16:56:57 2005
@@ -26,6 +26,10 @@
 import com.sun.mirror.declaration.Modifier;
 import com.sun.mirror.declaration.ParameterDeclaration;
 
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+import com.sun.mirror.apt.Messager;
+
 import com.sun.mirror.type.AnnotationType;
 
 import org.apache.beehive.wsm.jsr181.processor.apt.TypeMirrorUtil;
@@ -35,12 +39,29 @@
 public class MirrorParameterInfo implements JavaParameterInfo {
     
     protected ParameterDeclaration decl;
+    protected AnnotationProcessorEnvironment env;
+    protected Class clazz;
     
-    public MirrorParameterInfo(ParameterDeclaration decl) {
+    public MirrorParameterInfo(ParameterDeclaration decl, 
AnnotationProcessorEnvironment env) {
         if (null == decl) {
             throw new IllegalArgumentException("parameter declaration: 
<null>");
         }
         this.decl = decl;
+        this.env = env;
+        
+        // ensure required properties
+        try {
+            clazz = TypeMirrorUtil.classForName(decl.getType());
+        }
+        catch (ClassNotFoundException e) {
+            logError("cannot find parameter type: " + decl.getSimpleName());   
     
+        }
+    }
+    
+    public void logError(String msg) {
+        if (null != env) {
+            env.getMessager().printError(decl.getPosition(), msg);
+        }
     }
 
     public boolean isFinal() {
@@ -52,11 +73,6 @@
     }
     
     public Class getType() {
-        Class clazz = null;
-        try {
-            clazz = TypeMirrorUtil.classForName(decl.getType());
-        }
-        catch (Throwable t) { }
         return clazz;
     }
     
@@ -74,7 +90,8 @@
                 if (null != a) {
                     annotations.add(a);
                 }
-            } catch (ClassNotFoundException e) {
+            }
+            catch (ClassNotFoundException e) {
             }
         }
         return annotations;

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorTypeInfo.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorTypeInfo.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorTypeInfo.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorTypeInfo.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorTypeInfo.java
     (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/MirrorTypeInfo.java
     Tue Jan 25 16:56:57 2005
@@ -31,6 +31,10 @@
 import com.sun.mirror.declaration.Modifier;
 import com.sun.mirror.declaration.TypeDeclaration;
 
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Filer;
+import com.sun.mirror.apt.Messager;
+
 import com.sun.mirror.type.AnnotationType;
 
 import org.apache.beehive.wsm.jsr181.model.java.JavaMethodInfo;
@@ -39,23 +43,28 @@
 public class MirrorTypeInfo implements JavaTypeInfo {
 
     protected TypeDeclaration decl;
-    protected Collection<JavaMethodInfo> methods =
-        new ArrayList<JavaMethodInfo>();
+    protected AnnotationProcessorEnvironment env;
+    protected Collection<JavaMethodInfo> methods = new 
ArrayList<JavaMethodInfo>();
     
-    public MirrorTypeInfo(TypeDeclaration decl) {
+    public MirrorTypeInfo(TypeDeclaration decl, AnnotationProcessorEnvironment 
env) {
         if (null == decl) {
             throw new IllegalArgumentException("type declaration: <null>");
         }
         this.decl = decl;
+        this.env = env;
 
         Collection<? extends MethodDeclaration> mdecls = decl.getMethods();
         if (null != mdecls) {
             for (MethodDeclaration mdecl : mdecls) {
-                methods.add(new MirrorMethodInfo(mdecl));
+                methods.add(new MirrorMethodInfo(mdecl, env));
             }
         }
     }
 
+    public void logError(String msg) {
+        env.getMessager().printError(decl.getPosition(), msg);
+    }
+    
     public String getName() {
         return decl.getQualifiedName();
     }

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/TypeMirrorUtil.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/TypeMirrorUtil.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/TypeMirrorUtil.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/TypeMirrorUtil.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/TypeMirrorUtil.java
     (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/TypeMirrorUtil.java
     Tue Jan 25 16:56:57 2005
@@ -27,31 +27,40 @@
 
     // returns a class object of the specified type.
     public static Class classForName(TypeMirror type) throws 
ClassNotFoundException {
-        if (type instanceof PrimitiveType) {
-            return getPrimitiveClass(((PrimitiveType) type).getKind());
-        } else if (type instanceof VoidType) {
-            return void.class;
-        } else if (type instanceof ArrayType) {
-            Object[] typeOfArray = new Object[]{new Object()};
-            int arrayDepth = arrayDepth((ArrayType) type, 0, typeOfArray);
-            StringBuffer className = new StringBuffer();
-            for (int i = 0; i < arrayDepth; i++) {
-                className.append("[");
+
+        try {
+            if (type instanceof PrimitiveType) {
+                return getPrimitiveClass(((PrimitiveType) type).getKind());
+            }
+            else if (type instanceof VoidType) {
+                return void.class;
             }
-            TypeMirror mirrorTypeOfArray = (TypeMirror) typeOfArray[0];
-            if (mirrorTypeOfArray instanceof PrimitiveType) {
-                // e.g.   an array of int will be "[I".
-                
className.append(getTypeSignatureOfPrimitiveType(((PrimitiveType) 
mirrorTypeOfArray).getKind()));
-            } else {
-                // e.g.   an array of String will be "[Ljava.lang.String;".
-                className.append("L").append(((TypeMirror) 
typeOfArray[0]).toString()).append(";");
+            else if (type instanceof ArrayType) {
+                Object[] typeOfArray = new Object[]{new Object()};
+                int arrayDepth = arrayDepth((ArrayType) type, 0, typeOfArray);
+                StringBuffer className = new StringBuffer();
+                for (int i = 0; i < arrayDepth; i++) {
+                    className.append("[");
+                }
+                TypeMirror mirrorTypeOfArray = (TypeMirror) typeOfArray[0];
+                if (mirrorTypeOfArray instanceof PrimitiveType) {
+                    // e.g.   an array of int will be "[I".
+                    
className.append(getTypeSignatureOfPrimitiveType(((PrimitiveType) 
mirrorTypeOfArray).getKind()));
+                }
+                else {
+                    // e.g.   an array of String will be "[Ljava.lang.String;".
+                    className.append("L").append(((TypeMirror) 
typeOfArray[0]).toString()).append(";");
+                }
+                return Class.forName(className.toString());
             }
-            return Class.forName(className.toString());
+            return Class.forName(type.toString());
+        }
+        catch (ClassNotFoundException e) {
+            throw new ClassNotFoundException(type.toString());
         }
-        return Class.forName(type.toString());
     }
 
-    private static Class getPrimitiveClass(PrimitiveType.Kind kind) {
+    private static Class getPrimitiveClass(PrimitiveType.Kind kind) throws 
ClassNotFoundException {
         // todo: change order of the cases for better performance.
         switch (kind) {
             case BOOLEAN:
@@ -72,11 +81,10 @@
                 return short.class;
         }
 
-        // todo: throw ClassNotFoundException
-        return null;
+        throw new ClassNotFoundException();
     }
 
-    private static String getTypeSignatureOfPrimitiveType(PrimitiveType.Kind 
kind) {
+    private static String getTypeSignatureOfPrimitiveType(PrimitiveType.Kind 
kind) throws ClassNotFoundException {
         // todo: change order of the cases for better performance.
         switch (kind) {
             case BOOLEAN:
@@ -97,8 +105,7 @@
                 return "S";
         }
 
-        // todo: throw ClassNotFoundException
-        return null;
+        throw new ClassNotFoundException();
     }
 
     private static int arrayDepth(ArrayType type, int depth, Object[] 
typeOfArray) {
@@ -109,7 +116,4 @@
         }
         return ++depth;
     }
-
-}
-
-
+}
\ No newline at end of file

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java?view=diff&rev=126452&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java&r1=126451&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java&r2=126452
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
     (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
     Tue Jan 25 16:56:57 2005
@@ -100,12 +100,12 @@
                     om = getEndpointInterfaceObjectModel(endpointInterface);
                     
                     // merge abstract and concrete object models
-                    om.merge(new MirrorTypeInfo(classDecl));
+                    om.merge(new MirrorTypeInfo(classDecl, _env));
                 }
                 
                 // create object model from scratch
                 else {
-                    om = new Jsr181TypeMetadataImpl(new 
MirrorTypeInfo(classDecl));
+                    om = new Jsr181TypeMetadataImpl(new 
MirrorTypeInfo(classDecl, _env));
                 }
 
                 // check if we have an object model
@@ -124,7 +124,7 @@
                 messager.printNotice("processing service endpoint interface: " 
+ interfaceDecl.getQualifiedName());
                 
                 // create object model
-                Jsr181TypeMetadata om = new Jsr181TypeMetadataImpl(new 
MirrorTypeInfo(interfaceDecl));
+                Jsr181TypeMetadata om = new Jsr181TypeMetadataImpl(new 
MirrorTypeInfo(interfaceDecl, _env));
                 if (null == om) {
                     return;
                 }

Reply via email to