Return-Path: Delivered-To: apmail-incubator-openwebbeans-commits-archive@locus.apache.org Received: (qmail 86287 invoked from network); 9 Jan 2009 21:15:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jan 2009 21:15:56 -0000 Received: (qmail 60588 invoked by uid 500); 9 Jan 2009 21:15:56 -0000 Delivered-To: apmail-incubator-openwebbeans-commits-archive@incubator.apache.org Received: (qmail 60572 invoked by uid 500); 9 Jan 2009 21:15:56 -0000 Mailing-List: contact openwebbeans-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: openwebbeans-dev@incubator.apache.org Delivered-To: mailing list openwebbeans-commits@incubator.apache.org Received: (qmail 60561 invoked by uid 99); 9 Jan 2009 21:15:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jan 2009 13:15:56 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jan 2009 21:15:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 34B94238899B; Fri, 9 Jan 2009 13:15:30 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r733153 [2/2] - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: annotation/ component/ component/xml/ config/ container/ context/ decorator/ deployment/ el/ event/ inject/ inject/xml/ intercept/ intercept/w... Date: Fri, 09 Jan 2009 21:15:28 -0000 To: openwebbeans-commits@incubator.apache.org From: gerdogdu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090109211530.34B94238899B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=733153&r1=733152&r2=733153&view=diff ============================================================================== --- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java (original) +++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java Fri Jan 9 13:15:26 2009 @@ -197,7 +197,8 @@ if (!found) { found = true; - } else + } + else { return true; } @@ -249,7 +250,8 @@ if (type instanceof ParameterizedType) { return (Class) ((ParameterizedType) type).getRawType(); - } else + } + else { return (Class) type; } @@ -377,7 +379,8 @@ } } - } else + } + else { list.add(method.getName()); } @@ -637,12 +640,14 @@ if (before == null) { before = ann; - } else + } + else { if (before.equals(ann)) { throw new DuplicateBindingTypeException("Binding annotations can not contain duplicate binding : @" + before.annotationType().getName()); - } else + } + else { before = ann; } @@ -665,7 +670,8 @@ if (manager.isBindingTypeExist(clazz)) { return true; - } else if (clazz.isAnnotationPresent(BindingType.class)) + } + else if (clazz.isAnnotationPresent(BindingType.class)) { return true; } @@ -688,7 +694,8 @@ if (manager.isInterceptorBindingTypeExist(clazz)) { return true; - } else if (clazz.isAnnotationPresent(InterceptorBindingType.class)) + } + else if (clazz.isAnnotationPresent(InterceptorBindingType.class)) { return true; } @@ -713,7 +720,8 @@ if (isInterceptorBindingAnnotation(ann.annotationType())) { return true; - } else + } + else { continue; } @@ -769,7 +777,8 @@ if (isStereoTypeAnnotation(ann.annotationType())) { return true; - } else + } + else { continue; } @@ -793,7 +802,8 @@ if (manager.isStereoTypeExist(clazz)) { return true; - } else if (clazz.isAnnotationPresent(Stereotype.class)) + } + else if (clazz.isAnnotationPresent(Stereotype.class)) { return true; } Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=733153&r1=733152&r2=733153&view=diff ============================================================================== --- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original) +++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Fri Jan 9 13:15:26 2009 @@ -141,12 +141,14 @@ if (t.getName().equals(variable.getName())) { continue; - } else + } + else { return false; } - } else + } + else { return false; } @@ -169,7 +171,8 @@ return clazz; - } catch (ClassNotFoundException e) + } + catch (ClassNotFoundException e) { try { @@ -177,7 +180,8 @@ return clazz; - } catch (ClassNotFoundException e1) + } + catch (ClassNotFoundException e1) { try { @@ -185,7 +189,8 @@ return clazz; - } catch (ClassNotFoundException e2) + } + catch (ClassNotFoundException e2) { return null; } @@ -422,7 +427,8 @@ if (Error.class.isAssignableFrom(type) || RuntimeException.class.isAssignableFrom(type)) { return false; - } else + } + else { return true; } @@ -475,7 +481,8 @@ } return method.invoke(instance, args); - } catch (Throwable e) + } + catch (Throwable e) { throw new WebBeansException("Exception occurs in the method call with method : " + method.getName() + " in class : " + instance.getClass().getName()); } @@ -542,7 +549,7 @@ { return true; } - + return false; } @@ -554,7 +561,8 @@ { return clazz.getDeclaredConstructor(new Class[] {}); - } catch (Exception e) + } + catch (Exception e) { return null; } @@ -623,10 +631,12 @@ { clazz.getDeclaredConstructor(new Class[] {}); - } catch (SecurityException e) + } + catch (SecurityException e) { throw e; - } catch (NoSuchMethodException e) + } + catch (NoSuchMethodException e) { return false; } @@ -642,12 +652,14 @@ if (lhs instanceof ParameterizedType && rhs instanceof ParameterizedType) { return isAssignable((ParameterizedType) lhs, (ParameterizedType) rhs); - } else + } + else { if (lhs instanceof Class && rhs instanceof Class) { return isAssignable((Class) lhs, (Class) rhs); - } else + } + else { return false; } @@ -695,11 +707,13 @@ clazz.getDeclaredField(fieldName); - } catch (SecurityException e) + } + catch (SecurityException e) { // we must throw here! throw new WebBeansException(e); - } catch (NoSuchFieldException e2) + } + catch (NoSuchFieldException e2) { return false; } @@ -721,7 +735,8 @@ if (ok) { return true; - } else + } + else { ok = true; } @@ -740,11 +755,13 @@ return clazz.getDeclaredField(fieldName); - } catch (SecurityException e) + } + catch (SecurityException e) { // we must throw here! throw new WebBeansException(e); - } catch (NoSuchFieldException e2) + } + catch (NoSuchFieldException e2) { return null; } @@ -784,7 +801,8 @@ if (defineType.isAssignableFrom(parameterTypes.get(j))) { ok = true; - } else + } + else { ok = false; } @@ -825,7 +843,8 @@ if (defineType.equals(parameterTypes.get(j))) { ok = true; - } else + } + else { ok = false; } @@ -974,7 +993,8 @@ Asserts.assertNotNull(value, "value parameter can not be null"); return DateFormat.getDateTimeInstance().parse(value); - } catch (ParseException e) + } + catch (ParseException e) { // Check for simple date format SimpleDateFormat format = new SimpleDateFormat(WEBBEANS_DATE_FORMAT); @@ -993,7 +1013,8 @@ if (date == null) { return null; - } else + } + else { calendar = Calendar.getInstance(); calendar.setTime(date); @@ -1010,10 +1031,12 @@ if (type.equals(BigInteger.class)) { return new BigInteger(value); - } else if (type.equals(BigDecimal.class)) + } + else if (type.equals(BigDecimal.class)) { return new BigDecimal(value); - } else + } + else { return new WebBeansException(new IllegalArgumentException("Argument is not valid")); } @@ -1033,7 +1056,8 @@ { return ((ParameterizedType) clazz.getGenericSuperclass()).getActualTypeArguments(); - } else + } + else { return new Type[0]; } @@ -1047,7 +1071,8 @@ { return ((ParameterizedType) type).getActualTypeArguments(); - } else + } + else { return new Type[0]; } @@ -1136,7 +1161,8 @@ if (type instanceof ParameterizedType) { return checkParametrizedType((ParameterizedType) type); - } else if ((type instanceof TypeVariable) || (type instanceof WildcardType)) + } + else if ((type instanceof TypeVariable) || (type instanceof WildcardType)) { return false; } @@ -1212,7 +1238,8 @@ if (Arrays.equals(typeArguments, types)) { return true; - } else + } + else { Class superClazz = target.getSuperclass(); if (superClazz != null) Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java?rev=733153&r1=733152&r2=733153&view=diff ============================================================================== --- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java (original) +++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java Fri Jan 9 13:15:26 2009 @@ -31,7 +31,8 @@ { initialContext = new InitialContext(); - } catch (Throwable e) + } + catch (Throwable e) { LOGGER.error("Unable to initialize InitialContext object", e); throw new ExceptionInInitializerError(e); @@ -57,7 +58,8 @@ { initialContext.bind(name, object); - } catch (NamingException e) + } + catch (NamingException e) { LOGGER.error("Unable to bind object with name : " + name, e); } @@ -71,7 +73,8 @@ { initialContext.unbind(name); - } catch (NamingException e) + } + catch (NamingException e) { LOGGER.error(e); throw new WebBeansException("Unable to unbind object with name : " + name, e); Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=733153&r1=733152&r2=733153&view=diff ============================================================================== --- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original) +++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Fri Jan 9 13:15:26 2009 @@ -189,7 +189,8 @@ if (!isConstructureOk(clazz)) throw new WebBeansConfigurationException("Web Beans component implementation class : " + clazz.getName() + " must define at least one Constructor"); - } catch (WebBeansConfigurationException e) + } + catch (WebBeansConfigurationException e) { throw e; } @@ -213,7 +214,8 @@ if (inAnnotation == true)// duplicate @In { throw new WebBeansConfigurationException("There are more than one Constrcutor with Initializer annotation in class " + clazz.getName()); - } else + } + else { inAnnotation = true; result = constructor; @@ -235,7 +237,8 @@ if (btype != null) { throw new WebBeansConfigurationException("Constructor parameter binding type annotation can not be @Disposes annotation in class " + clazz.getName()); - } else + } + else { btype = param.annotationType().getAnnotation(Observes.class); if (btype != null) @@ -253,7 +256,8 @@ if ((result = ClassUtil.isContaintNoArgConstructor(clazz)) != null) { return result; - } else + } + else { throw new WebBeansConfigurationException("No constructor is found for the class : " + clazz.getName()); } @@ -393,30 +397,36 @@ if (src.equals(ConversationScoped.class)) { return true; - } else if (src.equals(ApplicationScoped.class)) + } + else if (src.equals(ApplicationScoped.class)) { if (target.equals(ConversationScoped.class) || (target.equals(ApplicationScoped.class))) { return false; - } else + } + else { return true; } - } else if (src.equals(SessionScoped.class)) + } + else if (src.equals(SessionScoped.class)) { if (target.equals(ConversationScoped.class) || target.equals(ApplicationScoped.class) || target.equals(SessionScoped.class)) { return false; - } else + } + else { return true; } - } else if (src.equals(RequestScoped.class)) + } + else if (src.equals(RequestScoped.class)) { return false; - } else + } + else { throw new WebBeansException("Scope is not correct"); } @@ -443,10 +453,12 @@ DefinitionUtil.defineInjectedFields(comp); DefinitionUtil.defineInjectedMethods(comp); - } else if (EJBWebBeansConfigurator.isEJBWebBean(clazz)) + } + else if (EJBWebBeansConfigurator.isEJBWebBean(clazz)) { comp = new NewComponentImpl(clazz, WebBeansType.ENTERPRISE); - } else + } + else { throw new WebBeansConfigurationException("@New annotation on type : " + clazz.getName() + " must defined as a simple or an enterprise web bean"); } @@ -474,11 +486,13 @@ { constructor = returnType.getConstructor(new Class[] { Annotation[].class, Class.class }); - } catch (SecurityException e) + } + catch (SecurityException e) { throw new WebBeansException("Security exception for getting EventImpl class constructor", e); - } catch (NoSuchMethodException e) + } + catch (NoSuchMethodException e) { throw new WebBeansException("No constructor found in EventImpl class", e); } @@ -549,7 +563,8 @@ if (found == true) { throw new WebBeansConfigurationException("@" + commonAnnotation.getSimpleName() + " annotation is declared more than one method in the class : " + clazz.getName()); - } else + } + else { found = true; result = method; @@ -622,7 +637,8 @@ if (found == true) { throw new WebBeansConfigurationException("@" + AroundInvoke.class.getSimpleName() + " annotation is declared more than one method in the class : " + clazz.getName()); - } else + } + else { found = true; result = method; @@ -676,21 +692,25 @@ if (annotation.equals(AroundInvoke.class)) { method = WebBeansUtil.checkAroundInvokeAnnotationCriterias(clazz); - } else if (annotation.equals(PostConstruct.class)) + } + else if (annotation.equals(PostConstruct.class)) { if (definedInInterceptorClass) { method = WebBeansUtil.checkCommonAnnotationCriterias(clazz, PostConstruct.class, true); - } else + } + else { method = WebBeansUtil.checkCommonAnnotationCriterias(clazz, PostConstruct.class, false); } - } else if (annotation.equals(PreDestroy.class)) + } + else if (annotation.equals(PreDestroy.class)) { if (definedInInterceptorClass) { method = WebBeansUtil.checkCommonAnnotationCriterias(clazz, PreDestroy.class, true); - } else + } + else { method = WebBeansUtil.checkCommonAnnotationCriterias(clazz, PreDestroy.class, false); } @@ -715,7 +735,8 @@ interceptor.setInjections(interceptorProxy); intData.setInterceptorInstance(interceptorProxy); - } else + } + else { if (ClassUtil.isContaintNoArgConstructor(clazz) == null) { @@ -725,10 +746,12 @@ intData.setInterceptorInstance(clazz.newInstance()); } - } catch (WebBeansConfigurationException e1) + } + catch (WebBeansConfigurationException e1) { throw e1; - } catch (Exception e) + } + catch (Exception e) { throw new WebBeansException(e); } @@ -758,11 +781,13 @@ if (type.equals(InterceptorType.AROUND_INVOKE)) { m = data.getAroundInvoke(); - } else if (type.equals(InterceptorType.POST_CONSTRUCT)) + } + else if (type.equals(InterceptorType.POST_CONSTRUCT)) { m = data.getPostConstruct(); - } else if (type.equals(InterceptorType.PRE_DESTROY)) + } + else if (type.equals(InterceptorType.PRE_DESTROY)) { m = data.getPreDestroy(); } @@ -805,7 +830,8 @@ ai.add(data); } - } else if (type.equals(InterceptorType.POST_CONSTRUCT)) + } + else if (type.equals(InterceptorType.POST_CONSTRUCT)) { m = data.getPostConstruct(); if (m != null) @@ -813,7 +839,8 @@ pc.add(data); } - } else if (type.equals(InterceptorType.PRE_DESTROY)) + } + else if (type.equals(InterceptorType.PRE_DESTROY)) { m = data.getPreDestroy(); if (m != null) @@ -828,11 +855,13 @@ if (type.equals(InterceptorType.AROUND_INVOKE)) { return ai; - } else if (type.equals(InterceptorType.POST_CONSTRUCT)) + } + else if (type.equals(InterceptorType.POST_CONSTRUCT)) { return pc; - } else if (type.equals(InterceptorType.PRE_DESTROY)) + } + else if (type.equals(InterceptorType.PRE_DESTROY)) { return pd; } @@ -909,7 +938,8 @@ { maxPrecedDeploymentType = dtAnnot; result = result2[0]; - } else + } + else { if (DeploymentTypeManager.getInstance().comparePrecedences(maxPrecedDeploymentType, dtAnnot) < 0) { @@ -948,7 +978,8 @@ buffer.setCharAt(3, Character.toLowerCase(buffer.charAt(3))); return buffer.substring(3); - } else + } + else { buffer.setCharAt(0, Character.toLowerCase(buffer.charAt(0))); return buffer.toString(); @@ -972,30 +1003,36 @@ if (deploymentTypeFound == true) { throw new WebBeansConfigurationException("@StereoType annotation can not contain more than one @DeploymentType annotation"); - } else + } + else { deploymentTypeFound = true; } - } else if (annotType.isAnnotationPresent(ScopeType.class)) + } + else if (annotType.isAnnotationPresent(ScopeType.class)) { if (scopeTypeFound == true) { throw new WebBeansConfigurationException("@StereoType annotation can not contain more than one @ScopeType annotation"); - } else + } + else { scopeTypeFound = true; } - } else if (annotType.equals(Named.class)) + } + else if (annotType.equals(Named.class)) { Named name = (Named) annotation; if (!name.value().equals("")) { throw new WebBeansConfigurationException("@StereoType annotation can not define @Named annotation with value"); } - } else if (AnnotationUtil.isBindingAnnotation(annotType)) + } + else if (AnnotationUtil.isBindingAnnotation(annotType)) { throw new WebBeansConfigurationException("@StereoType annotation can not define @BindingType annotation"); - } else if (AnnotationUtil.isInterceptorBindingAnnotation(annotType)) + } + else if (AnnotationUtil.isInterceptorBindingAnnotation(annotType)) { Target target = clazz.getAnnotation(Target.class); ElementType[] type = target.value(); @@ -1026,7 +1063,8 @@ throw new InconsistentSpecializationException("@Specializes exception. Class : " + clazz.getName() + " must have higher deployment type precedence from the class : " + superClass.getName()); } parent.getBindingTypes().addAll(child.getBindingTypes()); - } else + } + else { throw new WebBeansConfigurationException("@Specializes exception. WebBean component class : " + clazz.getName() + " does not extends other WebBeans it specialize"); } @@ -1181,7 +1219,8 @@ if (old == null) { old = interceptorBindingType; - } else + } + else { if (old.equals(interceptorBindingType)) { @@ -1211,7 +1250,8 @@ if (old == null) { old = bindingType; - } else + } + else { if (old.annotationType().equals(bindingType.annotationType())) { @@ -1310,7 +1350,8 @@ { return false; } - } else + } + else { throw new IllegalArgumentException("scopeType argument must be annotated with @ScopeType"); } Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=733153&r1=733152&r2=733153&view=diff ============================================================================== --- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java (original) +++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java Fri Jan 9 13:15:26 2009 @@ -152,7 +152,8 @@ if (DEPLOY_IS_DEFINED) { throw new DeploymentException("There can not be more than one web-beans.xml file that declares element"); - } else + } + else { if (!XMLUtil.isElementChildExist(child, WebBeansConstants.WEB_BEANS_XML_STANDART_ELEMENT)) { @@ -170,7 +171,8 @@ if (INTERCEPTORS_IS_DEFINED) { throw new WebBeansConfigurationException("There can not be more than one web-beans.xml file that declares element"); - } else + } + else { configureInterceptorsElement(child); INTERCEPTORS_IS_DEFINED = true; @@ -183,7 +185,8 @@ if (DECORATORS_IS_DEFINED) { throw new WebBeansConfigurationException("There can not be more than one web-beans.xml file that declares element"); - } else + } + else { configureDecoratorsElement(child); DECORATORS_IS_DEFINED = true; @@ -268,7 +271,8 @@ if (!clazz.isAnnotation()) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Binding type with given class : " + bindingTypeElement.getName() + " is not an annotation type"); - } else + } + else { clazzAnnot = (Class) clazz; } @@ -298,7 +302,8 @@ if (!clazz.isAnnotation()) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "InterceptorBinding type with given class : " + interceptorBindingTypeElement.getName() + " is not an annotation type"); - } else + } + else { clazzAnnot = (Class) clazz; } @@ -345,7 +350,8 @@ if (!clazz.isAnnotation()) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Stereotype with given class : " + stereoTypeElement.getName() + " is not an annotation type"); - } else + } + else { clazzAnnot = (Class) clazz; } @@ -378,7 +384,8 @@ if (clazz == null) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Interceptor class : " + XMLUtil.getName(child) + " not found"); - } else + } + else { if (!AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations())) { @@ -416,7 +423,8 @@ if (clazz == null) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Decorator class : " + XMLUtil.getName(child) + " not found"); - } else + } + else { if (manager.isDecoratorEnabled(clazz)) @@ -450,7 +458,8 @@ if (clazz == null) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "@DeploymentType annotation with name : " + XMLUtil.getName(child) + " not found"); - } else + } + else { if (!clazz.isAnnotation()) throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "@DeploymentType annotation with name : " + XMLUtil.getName(child) + " is not annotation type"); @@ -460,7 +469,8 @@ if (ann == null) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "@DeploymentType annotation with name : " + XMLUtil.getName(child) + " is not deployment type annotation"); - } else + } + else { DeploymentTypeManager.getInstance().addNewDeploymentType((Class) clazz, j++); } @@ -494,7 +504,8 @@ // Configure for EJB configureEJBWebBean(clazz); ok = true; - } else + } + else { /* Simple WebBeans */ if (SimpleWebBeansConfigurator.isSimpleWebBean(clazz)) @@ -553,12 +564,12 @@ /* Check if the deployment type is enabled. */ if (!DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(component.getDeploymentType())) // Maybe - // it - // is - // checked - // before - // the - // creation! + // it + // is + // checked + // before + // the + // creation! { component = null; @@ -619,7 +630,8 @@ isElementApplicable = true; - } else + } + else { if (!isConstructor) { @@ -659,14 +671,16 @@ isElementApplicable = true; } - } else + } + else { configureFieldOrMethodMetaData(component, child); fieldOrMethodName = name; isElementApplicable = true; } - } else + } + else { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Parent and child namespace has to be the same for field/method element decleration"); } @@ -691,7 +705,8 @@ { // Configure constructor parameters configureConstructorMetaData(component, constTypeList, constructorParameterElementList); - } else + } + else { // Default constructor component.setConstructor(WebBeansUtil.defineConstructor(component.getReturnType())); @@ -820,7 +835,8 @@ { ok = true; } - } else + } + else { ok = false; } @@ -833,7 +849,8 @@ if (found) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "More than one constructor decleration exist."); - } else + } + else { found = true; componentConstructor = constructor; @@ -872,7 +889,8 @@ { configureField(component, child); - } else if (XMLUtil.isElementMethod(child)) + } + else if (XMLUtil.isElementMethod(child)) { configureMethod(component, child); } @@ -930,13 +948,15 @@ isApplicable = true; } - } else + } + else { Class directChildType = XMLUtil.getElementJavaType(directChild); if (!ClassUtil.isAssignable(field.getType(), directChildType)) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Declared field type is not assignable to class field type"); - } else + } + else { XMLInjectionPointModel injectionPointModel = XMLUtil.getInjectionPointModel(directChild, createConfigurationFailedMessage()); component.addFieldInjectionPoint(field, injectionPointModel); @@ -957,7 +977,8 @@ if (!isValueElement) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "One of the direct childs of the field must be element "); - } else + } + else { if (isValueElement && isTypeElement) { @@ -1017,7 +1038,8 @@ if (childClazz == null) { throw new NonexistentTypeException(createConfigurationFailedMessage() + "Direct child element of method : " + XMLUtil.getName(methodChild) + " does not corresponds to any Java type"); - } else + } + else { if (childClazz.isAnnotation()) { @@ -1026,61 +1048,72 @@ if (isDefineType) { throw new WebBeansConfigurationException(moreThanOneChildTypeErrorMesg); - } else + } + else { checkConfigureDisposes(component, methodChild); isDefineType = true; type = 2; } - } else if (childClazz.equals(Observes.class)) + } + else if (childClazz.equals(Observes.class)) { if (isDefineType) { throw new WebBeansConfigurationException(moreThanOneChildTypeErrorMesg); - } else + } + else { checkConfigureObserves(component, methodChild); isDefineType = true; type = 3; } - } else if (childClazz.equals(Initializer.class)) + } + else if (childClazz.equals(Initializer.class)) { if (isDefineType) { throw new WebBeansConfigurationException(moreThanOneChildTypeErrorMesg); - } else + } + else { isDefineType = true; type = 0; } - } else if (childClazz.equals(Destructor.class)) + } + else if (childClazz.equals(Destructor.class)) { if (isDefineType) { throw new WebBeansConfigurationException(moreThanOneChildTypeErrorMesg); - } else + } + else { isDefineType = true; type = 4; } - } else if (childClazz.equals(Produces.class)) + } + else if (childClazz.equals(Produces.class)) { if (isDefineType) { throw new WebBeansConfigurationException(moreThanOneChildTypeErrorMesg); - } else + } + else { isDefineType = true; type = 1; } - } else if (AnnotationUtil.isInterceptorBindingAnnotation((Class) childClazz)) + } + else if (AnnotationUtil.isInterceptorBindingAnnotation((Class) childClazz)) { // InterceptorBindingType with method type = 5; - } else + } + else { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Direct child element of method : " + XMLUtil.getName(methodChild) + " with Java type : " + childClazz + " is unknown"); } @@ -1204,7 +1237,8 @@ { throw new NonexistentMethodException(createConfigurationFailedMessage() + "Method declaration with name " + XMLUtil.getName(child) + " is not found in the class : " + component.getReturnType().getName()); - } else if (definedMethods.size() > 1) + } + else if (definedMethods.size() > 1) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "More than one method : " + XMLUtil.getName(child) + " is found in the class : " + component.getReturnType().getName()); } @@ -1249,7 +1283,8 @@ if (observesChilds.size() != 1) { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Observes element : " + XMLUtil.getName(observes) + " can not contain more than one direct child elements"); - } else + } + else { Element child = observesChilds.iterator().next(); Class clazz = XMLUtil.getElementJavaType(child); @@ -1279,7 +1314,8 @@ // Default deployment type component.setType(stereoTypeDeploymentType); - } else + } + else { component.setType(JavassistProxyFactory.createNewAnnotationProxy(deploymentType)); } @@ -1299,7 +1335,8 @@ { // From stereotype DefinitionUtil.defineDefaultScopeType(component, createConfigurationFailedMessage() + "@ScopeType annotation is not configured correctly"); - } else + } + else { component.setImplScopeType(JavassistProxyFactory.createNewAnnotationProxy(scopeType)); } @@ -1363,11 +1400,13 @@ if (name != null && !name.equals("")) { component.setName(name); - } else + } + else { component.setName(WebBeansUtil.getSimpleWebBeanDefaultName(component.getReturnType().getName())); } - } else + } + else { DefinitionUtil.defineName(component, component.getReturnType().getAnnotations(), WebBeansUtil.getSimpleWebBeanDefaultName(component.getReturnType().getSimpleName())); } @@ -1466,12 +1505,14 @@ { component.addFieldValue(field, objVal); - } else + } + else { throw new WebBeansConfigurationException(errorMessage); } - } else if (ClassUtil.isEnum(fieldType)) /* Enumeration value */ + } + else if (ClassUtil.isEnum(fieldType)) /* Enumeration value */ { Enum enumValue = ClassUtil.isValueOkForEnum(fieldType, value); @@ -1482,11 +1523,13 @@ component.addFieldValue(field, enumValue); - } else if (fieldType.equals(String.class)) /* String value */ + } + else if (fieldType.equals(String.class)) /* String value */ { component.addFieldValue(field, value); - } else if (fieldType.equals(Date.class) /* + } + else if (fieldType.equals(Date.class) /* * Date, Time, Sql Date, * Time stamp, Calendar * value @@ -1498,19 +1541,22 @@ if (date == null) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { component.addFieldValue(field, date); } - } else if (fieldType.equals(Calendar.class)) + } + else if (fieldType.equals(Calendar.class)) { Calendar calendar = ClassUtil.isValueOkForCalendar(value); if (calendar == null) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { component.addFieldValue(field, calendar); } @@ -1529,34 +1575,40 @@ if (bigValue == null) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { component.addFieldValue(field, bigValue); } - } else if (fieldType.equals(Class.class)) /* Class value */ + } + else if (fieldType.equals(Class.class)) /* Class value */ { Class clazz = ClassUtil.getClassFromName(value); if (clazz == null) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { component.addFieldValue(field, clazz); } - } else if (List.class.isAssignableFrom(fieldType)) /* + } + else if (List.class.isAssignableFrom(fieldType)) /* * List * value */ { configureFieldListValue(component, field, child, errorMessage); - } else if (Set.class.isAssignableFrom(fieldType)) /* Set value */ + } + else if (Set.class.isAssignableFrom(fieldType)) /* Set value */ { configureFieldSetValue(component, field, child, errorMessage); } - } catch (ParseException e) + } + catch (ParseException e) { throw new WebBeansConfigurationException(errorMessage, e); } @@ -1601,17 +1653,20 @@ { isString = true; list = new ArrayList(); - } else if (Enum.class.isAssignableFrom(argClazz)) + } + else if (Enum.class.isAssignableFrom(argClazz)) { isEnum = true; list = new ArrayList(); - } else if (argClazz.equals(Class.class)) + } + else if (argClazz.equals(Class.class)) { isClazz = true; list = new ArrayList(); } } - } else + } + else { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "List field type with field name : " + field.getName() + " must be declared as ParametrizedType"); } @@ -1623,24 +1678,28 @@ if (isString) { list.add(value); - } else if (isEnum) + } + else if (isEnum) { Enum en = ClassUtil.isValueOkForEnum(argClazz, value); if (en == null) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { list.add(en); } - } else if (isClazz) + } + else if (isClazz) { Class clazz = ClassUtil.getClassFromName(value); if (clazz == null) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { list.add(clazz); } @@ -1688,17 +1747,20 @@ { isString = true; set = new HashSet(); - } else if (Enum.class.isAssignableFrom(argClazz)) + } + else if (Enum.class.isAssignableFrom(argClazz)) { isEnum = true; set = new HashSet(); - } else if (argClazz.equals(Class.class)) + } + else if (argClazz.equals(Class.class)) { isClazz = true; set = new HashSet(); } } - } else + } + else { throw new WebBeansConfigurationException(createConfigurationFailedMessage() + "Set field type with field name : " + field.getName() + " must be declared as ParametrizedType"); } @@ -1710,24 +1772,28 @@ if (isString) { set.add(value); - } else if (isEnum) + } + else if (isEnum) { Enum en = ClassUtil.isValueOkForEnum(argClazz, value); if (en == null) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { set.add(en); } - } else if (isClazz) + } + else if (isClazz) { Class clazz = ClassUtil.getClassFromName(value); if (clazz == null) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { set.add(clazz); } Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java?rev=733153&r1=733152&r2=733153&view=diff ============================================================================== --- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java (original) +++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java Fri Jan 9 13:15:26 2009 @@ -91,7 +91,8 @@ inherits = new HashSet(); inherits.add(inherit); xmlInterceptorBindingTypes.put(bindingType, inherits); - } else + } + else { inherits.add(inherit); } Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=733153&r1=733152&r2=733153&view=diff ============================================================================== --- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java (original) +++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java Fri Jan 9 13:15:26 2009 @@ -124,7 +124,8 @@ if (clazz.isAnnotationPresent(DeploymentType.class) || clazz.isAnnotationPresent(ScopeType.class) || AnnotationUtil.isBindingAnnotation(clazz) || AnnotationUtil.isInterceptorBindingAnnotation(clazz) || AnnotationUtil.isStereoTypeAnnotation(clazz) || clazz.equals(Named.class) || clazz.equals(Specializes.class) || clazz.equals(javax.webbeans.Interceptor.class) || clazz.equals(Decorator.class)) { continue; - } else + } + else { throw new WebBeansConfigurationException(errorMessage + " TypeLevelMeta data configuration is failed because of the class : " + clazz.getName() + " is not applicable type"); } @@ -159,7 +160,8 @@ if (found) { throw new WebBeansConfigurationException(errorMessage); - } else + } + else { metaType = temp; found = true; @@ -342,11 +344,13 @@ if (found) { throw new WebBeansConfigurationException(errorMessage + "More than one element exist for class : " + component.getReturnType().getName()); - } else + } + else { found = true; } - } else if (AnnotationUtil.isInterceptorBindingAnnotation(temp)) + } + else if (AnnotationUtil.isInterceptorBindingAnnotation(temp)) { Element annotationElement = annotationElementList.get(i); Annotation bindingAnnotation = XMLUtil.getXMLDefinedAnnotationMember(annotationElement, temp, errorMessage); @@ -380,7 +384,8 @@ if (found) { throw new WebBeansConfigurationException(errorMessage + "More than one element exist"); - } else + } + else { found = true; } @@ -413,7 +418,8 @@ XMLInjectionPointModel model = XMLUtil.getInjectionPointModel(type, errorMessage); WebBeansDecoratorConfig.configureXMLDecoratorClass((AbstractComponent) component, model); - } else + } + else { throw new WebBeansConfigurationException(errorMessage + "Delegate decleration must defined exactly one child element with name Decorates"); } @@ -449,7 +455,8 @@ if (producesDefined == false) { producesDefined = true; - } else + } + else { throw new WebBeansConfigurationException(errorMessage + "More than one element is defined"); } @@ -463,7 +470,8 @@ { arrayElement = producesElementChild; definedType = true; - } else + } + else { type = (Class) XMLUtil.getElementJavaType(producesElementChild); if (type == null) @@ -475,7 +483,8 @@ { memberLevelMetaData.add((Class) type); memberLevelElement.add(producesElementChild); - } else + } + else { if (!type.isAssignableFrom(producesMethod.getReturnType()) && !producesMethod.getReturnType().isAssignableFrom(type)) { @@ -485,7 +494,8 @@ if (definedType) { throw new WebBeansConfigurationException(errorMessage + "More than one Java type in the element"); - } else + } + else { typeElement = producesElementChild; definedType = true; @@ -498,7 +508,8 @@ { throw new WebBeansConfigurationException(errorMessage + " element must define at least one java type child"); } - } else + } + else { XMLInjectionPointModel injectionPointModel = XMLUtil.getInjectionPointModel(childElement, errorMessage); injectedParameters.add(injectionPointModel); @@ -633,7 +644,8 @@ if (disposalDefined == false) { disposalDefined = true; - } else + } + else { throw new WebBeansConfigurationException(errorMessage + "More than one element is defined for defining disposal method : " + disposalMethod.getName()); } Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java?rev=733153&r1=733152&r2=733153&view=diff ============================================================================== --- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java (original) +++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java Fri Jan 9 13:15:26 2009 @@ -102,7 +102,8 @@ if (element.getNamespaceURI() == null || element.getNamespaceURI().equals("")) { throw new WebBeansConfigurationException("All elements in the web-beans.xml file must have declared name space"); - } else + } + else { if (element.isRootElement()) { @@ -125,7 +126,8 @@ return document.getRootElement(); - } catch (DocumentException e) + } + catch (DocumentException e) { log.fatal("Unable to read root element of the given input stream", e); throw new WebBeansException("Unable to read root element of the given input stream", e); @@ -366,7 +368,8 @@ } - } else + } + else { return false; } @@ -396,7 +399,8 @@ { return true; - } else + } + else { Class clazz = getElementJavaType(child); if (clazz != null) @@ -477,7 +481,8 @@ if (child == null) { return false; - } else + } + else { return isElementInWebBeansNameSpace(child); } @@ -545,10 +550,12 @@ if (actualType == null) { throw new NonexistentTypeException(errorMessage + "Java type with name : " + getElementJavaClassName(typeElement) + " is not found in the deployment"); - } else if (((Class) actualType).isArray() || ((Class) actualType).isEnum()) + } + else if (((Class) actualType).isArray() || ((Class) actualType).isEnum()) { throw new WebBeansConfigurationException(errorMessage + "Java type with name : " + getElementJavaClassName(typeElement) + " must be class or interface type"); - } else if (((Class) actualType).isAnnotation()) + } + else if (((Class) actualType).isAnnotation()) { Class annotClazz = (Class) actualType; if (!AnnotationUtil.isBindingAnnotation(annotClazz)) @@ -559,7 +566,8 @@ if (definedBindingType == null) { definedBindingType = annotClazz; - } else + } + else { if (definedBindingType.equals(annotClazz)) { @@ -568,7 +576,8 @@ } bindingAnnots.add(getXMLDefinedAnnotationMember(childElement, annotClazz, errorMessage)); - } else + } + else { typeArguments.add(actualType); } @@ -649,11 +658,13 @@ /* Contains value member method */ annotClazz.getDeclaredMethod("value", new Class[] {}); - } catch (SecurityException e) + } + catch (SecurityException e) { throw new WebBeansException(e); - } catch (NoSuchMethodException e) + } + catch (NoSuchMethodException e) { throw new WebBeansConfigurationException(errorMessage + "Annotation with type : " + annotClazz.getName() + " must have 'value' method"); } @@ -667,11 +678,13 @@ { annotClazz.getDeclaredMethod(attrName, new Class[] {}); - } catch (SecurityException e) + } + catch (SecurityException e) { throw new WebBeansException(e); - } catch (NoSuchMethodException e) + } + catch (NoSuchMethodException e) { throw new WebBeansConfigurationException(errorMessage + "Annotation with type : " + annotClazz.getName() + " does not have member with name : " + attrName); } @@ -726,17 +739,21 @@ if (returnType.isPrimitive()) { value = ClassUtil.isValueOkForPrimitiveOrWrapper(returnType, attrValue); - } else if (returnType.equals(String.class)) + } + else if (returnType.equals(String.class)) { value = attrValue; - } else if (returnType.equals(Class.class)) + } + else if (returnType.equals(Class.class)) { value = ClassUtil.getClassFromName(attrValue); - } else if (returnType.isEnum()) + } + else if (returnType.isEnum()) { value = ClassUtil.isValueOkForEnum(returnType, attrValue); - } else + } + else { throw new WebBeansConfigurationException(errorMessage + "Annotation with type : " + annotClazz.getName() + " with member : " + attrName + " does not have sutiable member return type"); } @@ -748,11 +765,13 @@ annotation.setMemberValue(attrName, value); - } catch (SecurityException e) + } + catch (SecurityException e) { throw new WebBeansException(e); - } catch (NoSuchMethodException e) + } + catch (NoSuchMethodException e) { throw new WebBeansConfigurationException(errorMessage + "Annotation with type : " + annotClazz.getName() + " does not have member with name : " + attrName); } @@ -796,15 +815,18 @@ if (clazz.isAnnotation()) { anns.add(getXMLDefinedAnnotationMember(childElement, (Class) clazz, errorMessage)); - } else if (clazz.isArray() || clazz.isEnum()) + } + else if (clazz.isArray() || clazz.isEnum()) { throw new WebBeansConfigurationException(errorMessage + " element child with Java type : " + getElementJavaClassName(typeElement) + " must be class or interface type"); - } else + } + else { if (isElementTypeDefined) { throw new WebBeansConfigurationException(errorMessage + " element can not have more than one child element. It has one child element that declares its type"); - } else + } + else { model = new XMLInjectionPointModel(clazz); isElementTypeDefined = true; @@ -843,15 +865,18 @@ if (clazz.isAnnotation()) { anns.add(getXMLDefinedAnnotationMember(childElement, (Class) clazz, errorMessage)); - } else if (clazz.isArray() || clazz.isEnum()) + } + else if (clazz.isArray() || clazz.isEnum()) { throw new WebBeansConfigurationException(errorMessage + " element child with Java type : " + getElementJavaClassName(typeElement) + " must be class or interface type"); - } else + } + else { if (isElementTypeDefined) { throw new WebBeansConfigurationException(errorMessage + " element can not have more than one child element. It has one child element that declares its type"); - } else + } + else { isElementTypeDefined = true; component.addApiType(Array.newInstance(clazz, 0).getClass());